new form cursor start

lauras

Registered User.
Local time
Today, 08:51
Joined
Nov 18, 2010
Messages
21
When a new record is opened, I want the cursor to be at a certain field. I've tried giving the field tab the property of 0. I do not understand any languages used within access. Any help is appreciated!!
 
What you need to do is put some code in the FORM's On Current event.

Here's how you add code:

http://baldyweb.com/FirstVBA.htm

This is the code you put:
Code:
If Me.NewRecord Then
     Me.[COLOR=Red][B]NameOfControl[/B][/COLOR].SetFocus
End If

Substitute NameOfControl for the name of the textbox you would like to get focus.
 
In the On Current event of your Form try;
Code:
if me.newrecord = True Then
     Me.YourControlName.Setfocus
End If
If you always want the cursor to be in a particular location when you cahnge records simply reduce the On Current code to;
Code:
Me.YourControlName.Setfocus
 
Private Sub save___go_to_new_record_Enter()
If Me.NewRecord Then
Me.Account Number.SetFocus
End If
End Sub


Still doesn't bring the cursor to that field
 
Put the code in the form's On Current event, that way when ever you change record the current record will be tested to see if it is a new record or not.
 
Maybe I should reiterate. I and John mentioned the CURRENT event of the FORM, not the Enter event of a control. Click the top left hand corner of your form and look in the property sheet under the Events tab for that event.
 
did that, thanks for specifying.....now the cursor goes to the field below code states to go to. :mad:
 
The alternatie to .SetFocus is

DoCmd.GoToControl "ControlName"
 
The only other explanation is that you have specified the wrong control name. Remember it's the name of the control we're talking about not the field. A control being a textbox for example.
 
Private Sub Form_Current()
Me.Account_Number.SetFocus
End Sub

still not sending cursor to that field.
 
That isn't the code we gave you. Please follow exactly what you were given.
 
Private Sub Form_Current()
If Me.NewRecord = True Then
Me.Account_Number.SetFocus
End If

End Sub


still going to field BELOW Account_Number
 

Users who are viewing this thread

Back
Top Bottom