Oh men - you are so smart ! I used second of your post. No error, but now how can I carry over whole 20 records to open another form and let the user select which one is they need to edit? Thanks you thanks you ...
"Dirk Goldgar" wrote:
[Quoted Text] > "MN" <MN[ at ]discussions.microsoft.com> wrote in message > news:B03AB8D4-1E69-4B2A-8F62-EA4355AA8DA5[ at ]microsoft.com... > > 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) > >
|