Default from another form

Chris Watson

Registered User.
Local time
Today, 20:16
Joined
Jan 23, 2004
Messages
21
I have a table with a field [drivers name] that I want to default to another field in a form in the same db, is this possible???
 
As long as the form you are referring to remains open, you can set the default property of your control on the 2nd form to

=[Forms]![YourFormNameHere]![YourFieldNameHere]
 
Form not open

If the form is not open is there a way to do this.???
Thanks
 
You'll have to create a variable in a STANDARD Module (not a form module) like:
Public strDefault As String

And then refer to it. You'll have to find some event on the form you want the value from to set the variable:

strDefault = Me.YourTextBoxName
 
Default

Thanks Bob but Im an amature in Access, it sounds good, could you explain in more detail.
Thanks
 
Thanks Bob but Im an amature in Access, it sounds good, could you explain in more detail.
Thanks

Public strDefault As String
This is declared in a standalone Module that you create in the db window. Go to MODULES, then NEW. Type in the above, then save the module with a descriptive name.

Now the variable strDefault will be available to all the forms in your program. The only thing left to do is give it a value. You have to decide where to do that - but once that value is assigned - it will be available in any form using ... (for example)

strDefault = Me.YourTextBoxName

Any questions? - (there will be a test later ;))
 
Hi Wiz
Sorry for the delay in replying but I work away from home and only get back at weekends. I see what your saying but as I said im only a amature. You say asign a value, how do I do this?????
Chris
 
You assign a value to a variable just like he showed:
strDefault = Me.YourTextBoxName

make sure to follow his other instructions on how to declare the variable name and replace YourTextBoxName with the actual name of your textbox.
 

Users who are viewing this thread

Back
Top Bottom