VB6 - Quick Help!

Associate
Joined
12 Jan 2003
Posts
697
Location
York (+Lboro +New Malden)
I'm reading the value from a text box on one form using:

Val(InitialSelection.IN_AmbPres.Text)

into its parent form and writing it to an excel sheet using:

objWorkSheet.Range("B1").Value = Val(InitialSelection.IN_AmbPres.Text)


Now - It all worked yesterday. Today - Noop. Today, as it gets to the line just above it REOPENS the 'InitialSelection' form with all text boxes blank, writing a whole load of zeros into my excel sheet.

Why?
 
Just thought - is possibly due to how I've opened the form?

Private Sub ProcessData_Click()
Dim InitialSelection As New InitialSelection
InitialSelection.Show
End Sub
 
So you open a form fill out some text boxes, UNLOAD the form. RELOAD the form the next day and expect the text to still be in the boxes????

Unless you bind the textboxes to a data source you will need to add load save functions to the form.
 
So you open a form fill out some text boxes, UNLOAD the form. RELOAD the form the next day and expect the text to still be in the boxes????

Unless you bind the textboxes to a data source you will need to add load save functions to the form.

I'm glad you typed that 'cos I thought that yesterday and thought "I'm not typing that 'cos it sounds so obvious" :p
 
What is between the two lines?
something like
InitialSelection = Nothing

why don't you stick the value from the first
Val(InitialSelection.IN_AmbPres.Text)
in to a variable (or use whatever you put the value in on the parent form) then use
objWorkSheet.Range("B1").Value = someVariable

If you access anything on a form that has been closed it will open a new instance of that form again giving you the blank values.
 
Back
Top Bottom