New record in subform

G

Guest

If I have an unbound main form and want to move to a new record in a bound
subform, whats the code for that? I basically want to do a
DoCmd.GoToRecord,,acNewRecord
but the record is on a subform, not the main form

Thanks so much!!
 
A

Allen Browne

If this code is in the main form, you will need to set focus to the subform
first.

Something like this:
Me.[NameOfYourSubformHere].SetFocus
Me.[NameOfYourSubformHere].Form![NameOfYourTexbox].SetFocus
RunCommand acCmdRecordsGotoNew
 
G

Guest

Why not leave the NavigationButtons Property of the subform as yes, so you
want have to program your own buttons.
But if you want to set nice buttons on the form for the users to use, the
just like Allen said, you have to set the focus first to the subform other
wise Access try to move to the next record on the form where the buttons are,
which is the main form.
 

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

Similar Threads


Top