Get Displayed Text of a ComboBox

  • Thread starter David C. Holley
  • Start date
D

David C. Holley

I've been playing with programically getting the text value of a ComboBox,
but I keep getting an error message that the control has to have the focus
in order to reference the .Text property. If I explicity set the focus, I'm
able to get the value without any problems.

Is this normal?
 
S

Stuart McCall

David C. Holley said:
I've been playing with programically getting the text value of a ComboBox,
but I keep getting an error message that the control has to have the focus
in order to reference the .Text property. If I explicity set the focus,
I'm able to get the value without any problems.

Is this normal?

In Access, the Text property represents the current contents of the control
before it is updated. When focus is lost (when you tab or click to another
control), the Value property contains the control's current, updated value.
So to refer to it when another control has the focus, use the Value property
(actually you can abbreviate that to just the control's name, because Value
is it's default property).
 
R

Rick Brandt

David C. Holley said:
I've been playing with programically getting the text value of a ComboBox,
but I keep getting an error message that the control has to have the focus
in order to reference the .Text property. If I explicity set the focus,
I'm able to get the value without any problems.

Is this normal?

For Access yes. If you know the ordinal position of the column being
displayed you can use...

Me.ComboBoxName.Column(n)

....where n is the zero-based position of the column you want.
 

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