A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Set focus - the basics



 
 
Thread Tools Display Modes
  #1  
Old September 6th, 2006, 06:59 PM posted to microsoft.public.access.gettingstarted
Reader1
external usenet poster
 
Posts: 11
Default Set focus - the basics

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


  #2  
Old September 6th, 2006, 07:05 PM posted to microsoft.public.access.gettingstarted
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Set focus - the basics

Reader1 wrote:
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, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #3  
Old September 6th, 2006, 07:09 PM posted to microsoft.public.access.gettingstarted
Reader1
external usenet poster
 
Posts: 11
Default Set focus - the basics


"Rick Brandt" wrote in message
et...
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 ?


  #4  
Old September 6th, 2006, 07:20 PM posted to microsoft.public.access.gettingstarted
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Set focus - the basics

Reader1 wrote:
"Rick Brandt" wrote in message
et...
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 ?


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?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #5  
Old September 6th, 2006, 07:20 PM posted to microsoft.public.access.gettingstarted
Reader1
external usenet poster
 
Posts: 11
Default Set focus - the basics

I did it !!

:-)

I put it in the on load event procedure

Is that correct ?


  #6  
Old September 6th, 2006, 07:43 PM posted to microsoft.public.access.gettingstarted
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Set focus - the basics

Reader1 wrote:
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.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #7  
Old September 6th, 2006, 10:40 PM posted to microsoft.public.access.gettingstarted
Reader1
external usenet poster
 
Posts: 11
Default Set focus - the basics

"Rick Brandt" wrote in message
. net...

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

:-)


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.