Link to home
Start Free TrialLog in
Avatar of marku24
marku24Flag for United States of America

asked on

Run Save command from one Access form to another

I have a form (FormMain) and a subform (subformMain).  I am trying to execute a command while in FormMain but cannot get it to work until the data in subformMain is saved.  I can press a SAVE button in the subform and all works fine but I would like to automate this.  I would think it would be something like:

Form_FormMain.subformMain.runcmd save....   I know that is wrong but the concept is there.

Is there a way to run the save procedure from another form?

Thanks
Avatar of etech0
etech0
Flag of United States of America image

Try this:
DoCmd.Save(acForm, "NameOfFormToSave")

Open in new window

Avatar of marku24

ASKER

it is telling me the form isn't open but it is open.  I need to save the record.  Would I use acForm to save the record as well?
If you just want to save the data, you can try this:

Form_FormMain.subformMain.subformMain.dirty = false

Open in new window

Avatar of marku24

ASKER

it doesn't recognize dirty as a property and generates an error.  Also, am I writing the sub form name twice as you have above?
ASKER CERTIFIED SOLUTION
Avatar of marku24
marku24
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marku24

ASKER

This solution actually worked for me.  I posted it to help anyone searching.