Set Default value on Form

Ziggy1

Registered User.
Local time
Today, 16:59
Joined
Feb 6, 2002
Messages
462
I need to add a Constant variable on my form. The form uses a combo to select criteria. the criteria is then used when queries are run via buttons on the form. So I want to be able to select the criteria and I though the simplest way would be to right it to update the Default value of the Combo...but it won't work???

I made this up with a text control

Private Sub cobSystem_Change()


cobSystem.SetFocus
txtSystem.DefaultValue = cobSystem.Text

End Sub

the Text box comes up with #Name?


Thanks

Ziggy
 
Defaults are ONLY good for NEW records. So, setting a default value for something that isn't going to be a new record isn't going to help you at all.

I'm a bit confused as to what, exactly, you are trying to accomplish. The normal way for setting criteria via a form is to select, or input, the values you want into the control, or controls, and in the criteria section of the query you just reference the control like:

[Forms]![YourFormNameHere]![YourControlNameHere]

So what is this CONSTANT that you are looking for?
 
Thanks for replying Bob, The database does use criteria like you describe except in VBA (in this case) . But for the database as I distribute it to different departments, I need to make it easy for them to change the department code criteria.

so one way or another I need to be able to set/edit a "Constant", I'm not sure where I would put it? At any given time the user may choose to change the department code if they want to query another department.

It doesn't need to be a global constant because the form is setup as an "UPDATE", routine where the ODBC tables are queried and data gets appended.
 
Create a table to save the "Preferences" and then load those when you open the program. You can create a form to let the users set their preferences (this should be in a frontend/backend situation and each user having a copy of the frontend, with the preferences table being located locally in the frontend).
 
Thanks BOB, you have "Opened my eyes"...I was so focused on the form, it makes sense to use the table.

Thanks

Ziggy
 

Users who are viewing this thread

Back
Top Bottom