I have a read-only form that allows the user to browse clients. There
are buttons on the form that allow the user to 'Add New' or 'Edit Existing'.
They both lead to the same form: frmClient
frmClient has a single hidden field (ClientId), and a tab control with
several pages. Each page holds a subform that lists respectively client
details, invoices, payments, notes, etc. It is designed to only view 1
client at a time, ie - no scrolling through records on this form. That
can only be done on the form that calls it.
The 'Edit Existing' works fine with the commands
strID = CStr(Me!fsubClientBrowse.Form![ClientID])
strLinkCriteria = "[ClientId]=" & strID
DoCmd.OpenForm "frmClient", , , strLinkCriteria
However, I can't seem to get 'Add New' to function correctly. I am trying:
DoCmd.OpenForm "frmClient"
set frm = Forms!frmClient
frm.AllowAdditions = True
DoCmd.GoTorecord ,,acNewRec
frm.AllowAdditions = false
This creates a new record in the first page of the tab control, but not
on frmClient itself, which is sitting on the first record in tblClient,
and to which all the subsequent pages link to.
I can't create a new record and then snag the autoId and THEN open the
form, because there are required fields for the record that also do not
have defaults.
Suggestions?