Set focus - the basics

  • Thread starter Thread starter Reader1
  • Start date Start date
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
 
Reader1 said:
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

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

Me.gamma.SetFocus
 
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 ?
 
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?
 
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.
 
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

:-)
 

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

Similar Threads


Back
Top