GoToRecord

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
 
E

Elwin

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...
 
G

Guest

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

Please advise.

Thanks.
 
E

Elwin

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.
 
G

Guest

I was desperate searching for a solution on a similar problem. It worked perfectly. Thank you very much!!!
 
G

Guest

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top