Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving combox values 1

Status
Not open for further replies.

jommyjet

Technical User
May 19, 2003
49
US
I imagine this should be pretty simple.
I'd like to save the source values in several combo boxes on closing a form. I set up a button that prompts a subroutine to save the value of a combobo, ie,

Private Sub closeform_click()
save1 = employeeone.Value
DoCmd.Close acForm, "employeeselect", acSaveYes
End Sub

and then call that value on opening the form like so:

Private Sub Form_Open(cancel As Integer)
employeeone.Value = save1
End Sub

I may be in excel vba mode and am not saving the value correctly in the first sub.
Any help I appreciate
 
Access 2002
I should also mention that employeeone is the name of the control
 
thanks. that works great when the form is open, but on closing the form, all variables are lost.
I declared save1,... as public. is there something else I'm missing. Is it necessary to store the values in a table for later use?
 
Once a form is closed, it no longer exists. If you want the variables to be saved, you would need to create a module to have them stored in. The module is global and exists until the application is closed. You could also save them in a table, but you don't want an cluttered information if you are not going to use the value for anything else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top