Set focus - the basics

R

Reader1

I've been trying to 'set focus' to a field on one of my forms.

Formname = frm_Test

Field name = gamma

How do I set it so the field gamma is the field with focus ?

Please keep it simple - I've looked in these groups and on the web and I
can't seem to get it to work.
All I get is invalid macro name

Thank You
 
R

Reader1

Rick Brandt said:
Forms have *controls*, not *fields*. If your control (TextBox, ComboBox,
etc..) is named "gamma" then you would use...

Me.gamma.SetFocus

Sorry !

I meant controls really I did !

Where exactly do I put this text though ?
 
R

Rick Brandt

Reader1 said:
Sorry !

I meant controls really I did !

Where exactly do I put this text though ?

It's a line of VBA code so you put it in an event procedure that runs when
you want the focus to be set. When do you want this to happen?
 
R

Rick Brandt

Reader1 said:
I did it !!

:)

I put it in the on load event procedure

Is that correct ?

I suppose, but if you want a certain control to have focus when a form loads
then you don't need code at all. Just make that control first in the
TabOrder of the form.
 
R

Reader1

I suppose, but if you want a certain control to have focus when a form
loads then you don't need code at all. Just make that control first in
the TabOrder of the form.

Thanks for that tip - I didn't know that either

:)
 
Top