DoCmd.GoToRecord , , acNewRec

  • Thread starter Thread starter Leslie Isaacs
  • Start date Start date
L

Leslie Isaacs

Hello All

In the OnOpen event of a particular form I have:

DoCmd.GoToRecord , , acNewRec

This works fine when the form is opened on its own, but when it is opened as
a subfom on a main form it doesn't work - the subform is always displayed
with the cursor at record number 1. How can I get the 'DoCmd.GoToRecord , ,
acNewRec' command to work on the subform?

Hope someone can help
Many thanks
Leslie Isaacs
 
Leslie,

You must do it from the mai form's Open event, first setting focus to
the subform:

Private Sub Form_Open(Cancel As Integer)
Me.YorSubformObjectNameHere.SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub

HTH,
Nikos
 
Actually you did not multi-post, you cross-posted, which is a much
lesser evil :-) Sorry for the confusion!
 

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

Back
Top