Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
Old 10-06-2010, 08:00 AM   #1
Rx_
Nothing In Moderation
 
Rx_'s Avatar
 
Join Date: Oct 2009
Location: Denver, Colorado
Posts: 2,791
Thanks: 633
Thanked 334 Times in 306 Posts
Rx_ has a spectacular aura about Rx_ has a spectacular aura about Rx_ has a spectacular aura about
Post [solved] Error 2185 You can't reference a property or method for a control

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/...d.php?t=199489
Attached Images
File Type: png Error 2185 solved.png (12.4 KB, 390 views)

__________________
Were you lucky enough to get an answer? Please mark your question as [SOLVED] The original poster can go to Thread Tools to mark it as Solved.

Quotation Thomas Jefferson: "Peace is that brief glorious moment in history when everybody stands around reloading."

There are 2 Kinds of Countries on this Planet
1. Those that use the Metric System
2. Those that had a man walk on the moon

Denver, Colorado - The "Mile High City" - non-metric!
Rx_ is offline   Reply With Quote
Reply

Tags
2185 , combobox , control , error , focus

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference a control on a subform in a tab control! jkfeagle Forms 15 08-22-2016 01:41 PM
Replace parameter values in control source property theSizz Reports 1 05-09-2007 01:07 PM
Control property ValidationRule... can it reference another control? andreas_udby Forms 2 01-02-2005 03:42 PM
Re: reference a nested subform control in the subform alicejwz Forms 2 12-02-2004 01:27 AM
Major issues with 'setfocus' e2cheng General 9 01-13-2003 07:33 PM




All times are GMT -8. The time now is 06:06 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World