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

Add New Record to Subform 1

Status
Not open for further replies.

monrosal

Programmer
Aug 22, 2000
42
US
Does anyone know how to have a Add Record Command Button on a Main Form that will trigger the Subform to create a new record? If anyone knows, I'd really appreciate the help.
 
Yep:

'add record to sub form
Me![Yoursubform].SetFocus
DoCmd.GoToRecord , , acNewRec

'assign a value to a field in that sub form
Me![Yoursubform].Form![SomeField] = somedata
'save the record
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

' Requery the sub form
Me![Yoursubform].Requery

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top