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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter problems 1

Status
Not open for further replies.

BofRossClan

Technical User
Mar 26, 2002
39
US
I have a form that I use to lookup products. I have a combo box and the following code:
Code:
    strManuf = "'" & Me![cmbManufacturer] & "'"
    FilterOpt = Me!optFilterOpt
    
    Select Case FilterOpt
    
    Case 1
    Me.Filter = "[Manufacturer] like " & strManuf
    Me.FilterOn = True

    etc.

This code works GREAT! Unless the manufacturer name has an apostrophe. Then I get run-time error 3075. Syntax error. The code thinks the apostrophe in the variable is the end of my code. I have no control over the way the manuf name is entered, as I copy it from a different database that is not mine. Is there any way to code around this problem?
 
Foodlady:

Try using:
strManuf = chr(34) & Me![cmbManufacturer] & chr(34)

HTH,
Vic
 
Well, that stopped the error, but the filter doesn't work now.
 
Oh Wait! I'm sorry. I take that back. I was trying to look up a manufacturer that was in the OTHER database, but wasn't in MY database. It's working great. Think I'll change my combo box to only show records in my database. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top