[solved] Error 2185 You can't reference a property or method for a control (1 Viewer)

Rx_

Nothing In Moderation
Local time
Today, 01:56
Joined
Oct 22, 2009
Messages
2,803
Trying to read the Text in a combobox. The Value (usually an index) is available, but is not always what is needed. Sometimes we want the text.
The Text property is not available unless the control has the focus.
Here is an alternative

Run-time error '2185':
You can't reference a property or method for a control unless the control has the focus.

Read several quetions and feel that this is what people were asking for.
Did not readily find a post that puts the answer up front.
This might help the search.

Immediate Window example:
' combobox- retrieving Values
? Me!id_area.value
24
? Me!id_area.Text
*** SEE ERROR GENERATED --->>> 2185
Alternate Method
? Me!ID_Area.Column(0)
24
? Me!ID_Area.Column(1)
ND - Main Store

Note: Column(1) is a contrived value from two or more fields

Example:
msgbox "Thank You for choosing " & Me!ID_Area.Column(1), VBOKOnly, "Thanks Bonehead - for purchasing a T-Rex skull"


Also See:
http://www.access-programmers.co.uk/forums/showthread.php?t=199489
 

Attachments

  • Error 2185 solved.png
    Error 2185 solved.png
    12.4 KB · Views: 485

Users who are viewing this thread

Top Bottom