Tricky Text box question.

StefanSch

Registered User.
Local time
Today, 15:26
Joined
Jan 18, 2003
Messages
136
I have a form that should get a specific value in a text box when the form is being loaded. The specific value that the text box should take on is saved in a text box in another form and not in a table.

Right now I have the following code in the on load event of the form.

Private Sub Form_Load()
DoCmd.OpenForm ("Products")
DoCmd.Minimize
Me![HelpFigure2] = Forms("Products").HelpFigure1
End Sub

This works. However I would like to do this without having to open the form "Products". Can I do this?

Stefan
 
Have you tried a DLookup

Private Sub Form_Load()
DoCmd.OpenForm ("Products")
DoCmd.Minimize
Me![HelpFigure2] = DLookup("HelpFigure1","tblSomething","HelpFigure1=" & me![HelpFigure2]
End Sub

You'll have to check the syntax, but get that right and it should do the trick.
Dave
 
Not sure I fully understand what you mean by stored in a form, but either create a Public Variable or use the OpenArgs method, you should find examples of both here
 
I succeeded to find out how I have to create a global module to declare a global variable.

However, I do not know how to set the variable in one form and retrieve it in another form. Which on events do I have to use? Can you give me some code samples?

Thanks a lot. Stefan
 
My problem is that I do not know where to add these codes. Can you indicate WHERE to put the code for setting a value for the global variable and WHERE to put the code for retrieving a value for the global variable?

Thanks a lot.

Stefan
 

Users who are viewing this thread

Back
Top Bottom