By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

Save button in Main Form and save it on to Subform and on the Table

P: 3
Hello Sir, Im here again asking for help. I have a form and a subform relate to HVAC Windward Table. i have a SAVE button on the form that when clicked it saves data on the HVAC Windward Table but not in a subform. When manually inputing data into subform it saves by work order on the HVAC Windward Table in subdatasheet even if how many times i add data in one work order. Sir, Is it posible that when i clicked on the SAVE button in the form it saves the current data both on the HVAC Windward Table and to the subform as in same data in one work order, coz if the work order is "rescheduled" when i clicked SAVE button it will goes to subform and to the table and if re-entry the same work order is completed it will goes again in the subform and to the table, now there are two record in one work order in subform and to the HVAC Windward Table. Is there any code for this? Im using wizard to create SAVE command button and here's the code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Save_Record_Click()
  2. On Error GoTo Err_Save_Record_Click
  4. DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  6. Exit_Save_Record_Click:
  7. Exit Sub
  9. Err_Save_Record_Click:
  10. MsgBox Err.Description
  11. Resume Exit_Save_Record_Click
  13. End Sub
Any help would be appreciated..thanks and god bless!
Dec 18 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 374
OK, first thing is, that you don't need a save record button on the main form. When the focus of the form changes to the subform the main form record saves automaticly.

One thing that I need to make sure that is setup correctly is the relationship between the main and sub forms.

if you get into the properties of the sub form and make sure the following fields are filled out.

Link Child Field
Link Master Field

These two fields are what links the main form to the sub form so the relationship between the information on the main form and the sub form are sync'd

then when you enter information on the sub form, and long as you go to an new records before you close, then that should autosave the subform records without the need for save or update buttons on the form.

I hope that helps,

Joe P.
Jan 5 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.