
Originally Posted by
Robeen
I think you will have to 'couch' your Search1 in quotation marks since it is a string.
Try something like this:
Code:
"[BasicInfo].[YourName]= '" & Search1 & "'"
After the = sign is a single quote - ' - and a double quote - " .
After Search1 & is a double, a single and a double quote.
Look here for a good set of examples:
http://www.baldyweb.com/wherecondition.htm
This is almost always the answer, something up with the quotes. I've always found using double quotes works best for the code I write. To render one in your statement you need a pair of double quotes (" ") together: ""
So I would write like this: "[BasicInfo].[YourName]=""" & Search1 & """"
When processed the string will look like this: [BasicInfo].[YourName]="Dre"
You could also try to assign the value to a variable before using it to search:
dim searchstring as string
searchstring = "[BasicInfo].[YourName]=""" & Search1 & """"
msgbox searchstring 'so that you can see the criteria string passed before it runs
Me.Recordset.FindFirst searchstring