set focus

R

RHG

I have a combo box that gets populated with the index
fields. This is done to limit the search capabilities. In
order to do a docmd.findrecord I first need to set the
appropriate field with a .setfocus statement. The question
is how can i set focus to the selected value of the combo
box? I have tried combobox.value.setfocus but it did not
work.
 
B

Bas Cost Budde

RHG said:
I have a combo box that gets populated with the index
fields. This is done to limit the search capabilities. In
order to do a docmd.findrecord I first need to set the
appropriate field with a .setfocus statement. The question
is how can i set focus to the selected value of the combo
box? I have tried combobox.value.setfocus but it did not
work.

Me.Controls(combobox).SetFocus

and since the controls collection is the default for a form, you can
also use

Me(combobox).SetFocus
 
R

RHG

I get a runtime error 438.
Object doesnt support this property or method

me.controls(cbo).setfocus

where cbo is the name of the combobox
 
B

Bas Cost Budde

RHG said:
I get a runtime error 438.
Object doesnt support this property or method

me.controls(cbo).setfocus

where cbo is the name of the combobox

And what is the value of cbo at the time the error occurs? Likely the
name of a control that doesn't support SetFocus
 

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

Focus in a list box 4
Search via VBA 3
In MS Access, how can I not show the down arrow for a Combo Box? 4
How to set focus on a form 2
Find Record 1
Set Focus 2
Calendar Pop-Up in Access (VBA) 1
Bookmarking 1

Top