Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RUN TIME ERROR 2185

Status
Not open for further replies.

philipmck

Technical User
Jul 30, 2008
21
EU
When i run the program i get a run time error "2185" for the below code. As far as i know it is to do with the .text function but i dont know what i can replace it with as it is used in conjuction with a text field.

\\VB CODE//

If Me.ProcessCombo.Text = "...." & Me.Option1Combo.Text = "...." & Me.Option2Combo.Text = "..." Then Me.SEARCH.Caption = "....
 
This:

Me.SEARCH.Caption = "...."

Is most likely the problem. Change .Caption to .Text and see how it works.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
I have done that and i got the following pop-up box:

Complile error:
Method or data member not found

I did notice in the list of options that appears when you insert "." the text option was not available. The only place in the list text is mentioned is controltiptext and status bar text

\\VB CODE//

If Me.ProcessCombo.Text = "...." & Me.Option1Combo.Text = "...." & Me.Option2Combo.Text = "..." Then Me.SEARCH.Text = "...."
 
Ok, sorry about that. I just know that some controls (like Labels) in VB6 used .Caption and it was changed to .Text in VB .NET, so I thought that might be the issue.

Here's a question: Is this code from Access?



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Yeh. Basically what happens is the search button takes 3 bits of text from 3 combo boxes. the text selected is obviously what the user has selected in the list. The search button then matches the text up with the bit of code that has the same information it would match .... , ... , ... with the code below. Me.search.text then puts what is in the quotes into a text field which then searches the database to find a match.

I hope this makes a little bit of sense

\\VB CODE//

If Me.ProcessCombo.Text = "...." & Me.Option1Combo.Text = "...." & Me.Option2Combo.Text = "..." Then Me.SEARCH.Text = "...."

ps thanks for your help
 
Happy to be of assistance!

I think you will get a better response to your question in one of the following Tek-Tips forums:

forum705

forum707

This forum, while it is a VB forum, is for VB .NET and as such we can't provide you as good an answer as one of the above forums.

Good luck!


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Code:
If Me.ProcessCombo.Text = "...." & Me.Option1Combo.Text = "...." & Me.Option2Combo.Text = "..." Then  Me.SEARCH.Caption = "...."
You can't use the ampersand (&) in VBA an ampersand is used to concatenate strings.
Code:
If Me.ProcessCombo.Text = "...." [red]AND[/red] Me.Option1Combo.Text = "...." [red]AND[/red] Me.Option2Combo.Text = "..." Then  Me.SEARCH.Caption = "...."

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top