New record in subform

  • Thread starter Thread starter Guest
  • Start date Start date
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!!
 
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
 
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.
 
Back
Top