Question : Dash or hyphen in findfirst criteria

I have found a lot of info on apostrophe's with findfirst but what about a dash or a hyphen.
I have a users who enter a company as ABC - DEF.  When I select the name from the dropdown menu I get the error...
Syntax error (missing operator) in expression.
Company names with an apostrophe work fine.  Is there a way to fix it for a dash?

Answer : Dash or hyphen in findfirst criteria

Your FindFirst syntax is wrong. FindFirst accepts a ColumnName, and then the value you wish to find in that Column. The fact that ones with an apostrophe work is a mystery to me - you should error out every time the compiler reaches that line.

However, your query does include a column named "CoNmeCoID", which you may be able to use:

rs.FindFirst "CoNmeCoID='" & Me.cboEmployerContact & "'"

I'm acutally surprised the other syntax would work at all ... it should have never found anything ...

Random Solutions  
 
programming4us programming4us