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

Saving through Code

Status
Not open for further replies.

JDU

Technical User
Dec 23, 2002
182
US
I have a subform that changes. How can I save it through code before closing.

When I use the command:
docmd.save acForm, FormName

I get the message that the subform is not open; however, the subform is open on the form.

Am I missing something

Thanks
 
Code:
docmd.save acForm, FormName
will only work on the form (not subforms). Try using the following code in the main Form's On Close event:

Code:
    Me!subformcontrolname.Form.Refresh

Replace
Code:
subformcontrolname
with the actual subform control name (NOT the subform's name in the Database window) used on your form.

Note: the Refresh method will complete any pending form updates. Jim Kraxberger
Developing Access solutions since 1995
 
The above suggestion didn't work. Maybe I should be more clear. I have 3 subforms on a form whose txtbox names and controlsources I change via code. Consequently when I go to close the form, I am prompted to save the 3 subforms.

I would like this to happen via code and therefore no prompting.

Does this help?

Thanks
 
Does Anyone have a suggestion on this?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top