MN said:
Yeah-Here is the code in the form:
Dim strSql As String
strSql = "SELECT * " & vbCrLf & _
"FROM dbo_A " & vbCrLf & _
"WHERE Soundex(lname)=soundex([forms]![FrmMain]![lName]) And
Soundex(Fname)=soundex([forms]![FrmMain]![FName]);"
There has to be more than that, since that code can't in itself raise the
error you posted. I'll bet you have code farther down in that procedure
that opens a recordset on that SQL string; something like this:
Set rs = CurrentDb.OpenRecordset(strSQL)
or (using ADO),
rs.Open strSQL
If my guess is right, your problem can be averted by building the values of
the form controls directly into the SQL string as quoted literals, like
this:
strSql = _
"SELECT * FROM dbo_A " & _
"WHERE Soundex(lname)=soundex(" & _
Chr(34) & Forms!FrmMain!lName & Chr(34) & _
") And Soundex(Fname)=soundex(" & _
Chr(34) & Forms!FrmMain!FName & Chr(34) & _
");"
In fact, it's quite likely that you can embed the soundex-converted versions
of the form controls into the string, instead of the control values
themselves. So this might work even better:
strSql = _
"SELECT * FROM dbo_A " & _
"WHERE Soundex(lname)='" & _
Soundex(Forms!FrmMain!lName) & _
"' And Soundex(Fname)='" &
Soundex(Forms!FrmMain!FName) & _
"');"
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)