Set focus in a certain field in a subform....

raghuprabhu

Registered User.
Local time
Today, 08:45
Joined
Mar 24, 2008
Messages
154
Hi,
I am trying to add a new record in a sub form. The following code is working. How do I make the cursor to go to a certain field in the form? I want the cursor to go to or set focus in a field named eDate.

Private Sub cmdAddNewReocrd_Click()
Me.SF_AccountsSub.SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub

Thanks.

Cheers
Raghu Prabhu
 
Hi,

First you have to use setfocus to select the form (as you have done), then you can use it again to select the control on the form.

Try this:

Private Sub cmdAddNewReocrd_Click()
Me.SF_AccountsSub.SetFocus
DoCmd.GoToRecord , , acNewRec
Me!SF_AccountsSub.Form!eDate.SetFocus
End Sub
 

Users who are viewing this thread

Back
Top Bottom