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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save form status

Status
Not open for further replies.

Hammondo

MIS
Jan 14, 2002
23
0
0
NL
I have a form containing numerous subforms. A user may make selections of records on both the main and subforms. How can I save the status of the Main and Subforms when the user exits from the main form, so that when the form is next opened, the selections remain intact and the user doesn;t have to go over the selection procedure all over again?
 
One way to do it is to create a tiny one record table with enough fields to store the record_id's of each record that you want to save from the other tables.

Then in the "on close" event of each of the forms, you can have code that will store the curent record_id's into that table.

If you have a first record in this tiny table that has a record id of its own with a value equal to 1, you can just use a docmd.runSQL statement to update the values of that record: docmd.runSQL "Update . . . in [tinytable] where [recfield] = 1"

In the 'on load' events of the forms, you can include code that will position each of the forms correctly. I generally use the same search code that's generated by the combo box wizard when you use it look up a value on your form.

If a subform is linked to the main form, there's no need to save that subform's record_id. When you set the record position on the main form, the subform will automatically reposition. -- Herb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top