cursor in first field of new record

G

Guest

Hi folks, I have added a command button to a form which uses the command
button wizard to go to a new record. It uses
DoCmd.GoToRecord , , acNewRec

I would like the cursor to appear in the first field of the new form. what
do I need to add?

many thanks
 
A

AlCamp

Bush,
Check out the Tab Order in Help. The TabIndex property controls the
order that controls are accessed by tabbing. TabIndex numbers start with 0,
1, 2, 3, etc.
Also, in form Design Mode, you can select View/TabOrder, and a dialog box
will open to assist you in setting up the order in which the cursor will
move from control to control.
Make sure the field you want access first has TabIndex = 0 and TabStop =
YES, and that the field in Enabled.
hth
Al Camp
 
T

tina

DoCmd.GoToRecord , , acNewRec

under that line of code, add this

Me!NameOfControl.SetFocus

substitute the name of the control you want the cursor to go to in the new
record of course. btw, these are called controls, not fields. controls in a
form are bound to fields in the form's underlying table or query. using the
correct terms will help you ask questions and understand the answers. :)

hth
 
G

Guest

thanks very much. It worked fine. I had been trying GetFocus instead of
SetFocus. You're right Tina. I need to get on top of the correct terminology.
 
S

StCyrM

Good morning

Simply set the focus to the appropriate field.

Best Regards

Maurice St-Cyr
Micro Systems Consultants, Inc.
 

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

Top