bill201
asked on
add new record on a other open form with vba on microsoft access 2013
hi
i can two forms open for expamle the names are form1 and form2
and i wan't when i press on some button in form2 it's will set the focus on form1 in a new record by the field form1!Id
something like this
DoCmd.GoToRecord (on form1) , , acNewRec
DoCmd.GoToControl ("form1!InvoiceNum")
i can two forms open for expamle the names are form1 and form2
and i wan't when i press on some button in form2 it's will set the focus on form1 in a new record by the field form1!Id
something like this
DoCmd.GoToRecord (on form1) , , acNewRec
DoCmd.GoToControl ("form1!InvoiceNum")
ASKER
thanks alot for your answer but i get an error message after the first line (it's a sub form so it's look like this :
DoCmd.GoToRecord acDataForm, "Forms!form1parent!form1ch ild.Form", acNewRec
and i get an error message like this "run time error 2489 the object "Forms!form1parent!form1ch ild.Form" isn't open. But the form is actually open, so what is going on there?
DoCmd.GoToRecord acDataForm, "Forms!form1parent!form1ch
and i get an error message like this "run time error 2489 the object "Forms!form1parent!form1ch
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try these codes:
DoCmd.GoToRecord acDataForm, "form1", acNewRec
Forms!form1.SetFocus
Forms!form1!InvoiceNum.Set
Sincerely,
Ed