Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus on first field

Status
Not open for further replies.

kbear

MIS
Sep 18, 2001
100
US
I have read pages of posts on setting the focus but they involve much VBA code. I'm hoping there is an easy way to do this in the Access form. When moving between records in a simple form with one table, how can I ensure that the focus is always on the first field? Please, hopefully something easy. Thanks so much.
 
This does not require a lot of VBA code. In the form's current event, you just need one simple line of code.

Code:
Private Sub Form_Current()
   Me.ToDate.SetFocus
End Sub
 
Obviously, you'll need to replace "ToDate" with the name of your first field.
 
Easy enough:
Private Sub Form_Current()
Me.Proposal#.SetFocus
End Sub

But I'm getting
Compile error:
Method or data member not found

 
And this ?
Me![Proposal#].SetFocus

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Now I get
Object doesn't support this property or method.
 
What is Proposal# in your form ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I do this on almost all of my forms.

As above create an On Current procedure for the form

Private Sub MyFormName_Current()
Me.MyFieldName.SetFocus
End Sub

MyFieldName should be the Name of the control you want to move to, and should appear as soon as you type Me.
 
Proposal# is the field name but the control name has a space in it. I was trying to use the field name. When I put the space [Proposal #], it works. Thank you everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top