When open a form go to the new record

yhchen

Registered User.
Local time
Today, 04:22
Joined
Jul 6, 2008
Messages
63
I made this simplest code so when the form opened it would go to the new record but sadly this simplest code in the world doesn't work... :(


Private Sub Action1_Open()

DoCmd.GoToRecord , , acNewRec

End Sub

On the form property, I set Open to Event Procedure but it is not working...

please help!!
 
I've done the same thing and it works. However, I note your sub is an action1_open rather than a form_open sub. Try this below and see if that works.

Private Sub Form_Open(Cancel As Integer)

DoCmd.GoToControl "txtCallDate"
DoCmd.GoToRecord , , acNewRec
End Sub
 
That doesn't look right, as normal form open code would be:

Private Sub Form_Open()

Where it says Event Procedure, click on the ellipsis (...) to the right and put the code there.
 
I've done the same thing and it works. However, I note your sub is an action1_open rather than a form_open sub. Try this below and see if that works.

Private Sub Form_Open(Cancel As Integer)

DoCmd.GoToControl "txtCallDate"
DoCmd.GoToRecord , , acNewRec
End Sub

Hi thanks a lot

The below code works...

Code:
Private Sub Form_Open(Cancel As Integer)

DoCmd.GoToRecord , , acNewRec
End Sub
 

Users who are viewing this thread

Back
Top Bottom