Desert Bear said:
I have just created a new person record in frmAddPerson, based on
tblPeople.
I need to create matching records in tblVersion and tblEval, which
are not part of frmAddPerson. I created frmAddVersion which is opened
to create the tblVersion record. It's clumsy but works.
DoCmd.GoToRecord acDataTable = "tblVersion", acNewRec
gives a type mismatch.
What is the correct format?
I'm not sure, because it isn't clear to me what that line is supposed to
do. If you've opened frmAddVersion in normal mode and now want to tell
it to go to a new record, you would write
DoCmd.GoToRecord acDataForm, "frmAddVersion", acNewRec
If you only want to open this form for the purpose of adding a new
record, you could open the form in data entry mode in the first place:
DoCmd.OpenForm "frmAddVersion", DataMode:acFormAdd
And if the form is designed *only* to be opened in "add" mode, you could
set that in the form's properties, just by setting the form's Data Entry
property to Yes. Then you wouldn't even have to specify the data mode
when opening the form.
Be aware, by the way, if you aren't already, that if you already have
all the information you need to create the new records, you don't have
to open forms to do it. You can just add the records directly to the
underlying tables, without opening the forms. You'd only open the forms
if you need the user to provide more information for each record than
you already have.