Command, On Click, Save Form and Sub-form possible?

TDC21

Board Regular
Joined
Mar 31, 2017
Messages
97
I have two tables, Order and Order_Line, a one to many relationship exists and I created a form with a sub-form. I added a on click save command but it looks like the command is only associated with the Order table though. On click the order table is updated with the new entries but none of the Order_Line entries are carried over. Can the command be altered to save both the Form and the Sub_Form on click? If so, how?

Thanks everyone, any suggestions are appreciated as always
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Whatever you're doing for the main form should work if you know and use the correct subform reference
Forms("MainFormName").Controls("subformControlName").Form.Requery
NOTE: subformControlName IS NOT THE SUBFORM NAME - it is the control that contains the subform

You might be working with the .Dirty property as opposed to the Requery method - you don't say.

There's another syntax that I use for referencing subform controls instead of properties:
[Forms]![Main form name]![subform control name].[Form]![control name on subform]

For some reason, I never got that syntax to work when accessing subform properties or methods (like RecordCount or Requery), so I use the former. If you care to give it a try, it would probably be
[Forms]![Main form name]![subform control name].[Form].Requery or
[Forms]![Main form name]![subform control name].[Form]!Requery

Something tells me those won't work.
 
Last edited:
Upvote 0
You're welcome.
We/I would be interested to know which, if either, syntax worked.
Thanks.
 
Upvote 0

Forum statistics

Threads
1,221,657
Messages
6,161,084
Members
451,684
Latest member
smllchng5

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top