Search Using Combo box Not Fnding Record

TanMan

Registered User.
Local time
Today, 16:45
Joined
Oct 15, 2010
Messages
16
I have a combo box that I use to lookup a record, It is giving me problems.
Example of data in the combo box
· Adjustable Leg: # P67490-2510
· Air Hose Bibb: 3/8 X 3/8
The first example does not return a record; the second example returns the correct record
If I remove the # symbol from the first example it returns the correct record
Is there any way to solve this problem and still use the # symbol?
 
# is a special character in SQL. It signals the beginning or end of an alpha numeric date in a SQL statement. Look at the actual SQL of your filtered record to be sure that it's building correctly and actually runs. It may be generating an error. You might have to use the ASCII code for the # or the Replace function to filter out the # in your SQL. It may be a pain.
 
I have attached a shot of my vba window to illustrate the problem I am having
 

Attachments

  • Search copy.jpg
    Search copy.jpg
    57.4 KB · Views: 108
Code:
dim rst as dao.recordset

set rst = me.recordsetclone

rst.findfirst "[ProductName] = " & Me.cboProductSearch

if not rst.nomatch then
    me.bookmark = rst.bookmark
end if
 
Thanks for the code

I get and error

rst.FindFirst "[ProductName] =" & Me.cboProductSearch

Syntax error (missing operator) in expression
 
Oops..
Code:
rst.findfirst "[ProductName] = '" & Me.cboProductSearch & "'"
 

Users who are viewing this thread

Back
Top Bottom