GoToRecord

  • Thread starter Thread starter Derik Tran
  • Start date Start date
D

Derik Tran

How do I add a new record using the GoToRecord method in
a subform?

I want to place a button on the main form to add a new
record on my subform. Can this be done?

Please advise.

Thanks,
Derik
 
I don't have access installed on this machine, so I can't
test this out, but it should be something like...

Me!subformName.SetFocus
Me!subformName.Form!controlName.SetFocus
DoCmd.RunCommand acGoToRecord acNew

I hope this helps...
 
Thanks for your prompt response, but I'm not sure what's
a control name.

Please advise.

Thanks.
 
In my example, 'subformName' is whatever the name property
of your subform control is set to. 'controlName' is
whatever the name property of a bound control on your
subform is set to. You can set the name property to
whatever you like, usually something that means something
to you. It often defaults to something like 'Text32' or a
field name.
 
I was desperate searching for a solution on a similar problem. It worked perfectly. Thank you very much!!!
 
In Access 2002 it appears to be a little different
DoCmd.GoToRecord acActiveDataObject, <controlname>, acNewRe

But I too was searching for the solution to this for ages, so thanks from me too, Elwin!
 
Back
Top