set focus for a control

W

who can help me

most of the time when i write a code and attaced it to a command i will be
receiving this error message:You can reference a property or method for a
control unless you the control has a focus

pls how can I set a focus for a control
 
L

Linq Adams via AccessMonster.com

There are relatively few times when a control has to have focus to be
referenced; are you, perhaps, trying to use the Text property of textboxes,
something like

Me.ControlNameHere.Text

If so, you're far better off simply using

Me.ControlNameHere.Value

or

Me.ControlNameHere

which is the same thing (Value being the Default property for a textbox in
VBA)
and doesn't require that the control have focus in order to reference it.
 

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