DAO FindFirst Criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have difficulties in assigning a criteria for a search, I'm using DAO and I get this error message "Syntax error (missing operator) in expression".
My expression is : rst.FindFirst "[fldDate] = #" & Date & "# & " & "[fldInsertDesign] = '" & rstInsertDiscard.Fields("fldInsertDesign") & "'"

Basically, the criteria is to match 2 fields (fldDate and fldInsertDesign) in the table with the values from current date and a fields from another recordset.
Please help.

Cheers,
Djoezz
 
Djoezz,

rst.FindFirst "[fldDate] = #" & Date & "# AND [fldInsertDesign] = '" &
rstInsertDiscard.Fields("fldInsertDesign") & "'"

should do it.

HTH,
Nikos

Djoezz said:
I have difficulties in assigning a criteria for a search, I'm using DAO
and I get this error message "Syntax error (missing operator) in
expression".
My expression is : rst.FindFirst "[fldDate] = #" & Date & "# & " &
"[fldInsertDesign] = '" & rstInsertDiscard.Fields("fldInsertDesign") & "'"
Basically, the criteria is to match 2 fields (fldDate and fldInsertDesign)
in the table with the values from current date and a fields from another
recordset.
 
rst.FindFirst "[fldDate] = #" & Date & "# AND [fldInsertDesign] = '" &
rstInsertDiscard.Fields("fldInsertDesign") & "'"

should do it.

Not outside the USA it won't.


Tim F
 
Thanks Nikos
I'll give it a try,..

Tim
you mean the date format difference, right? I'll work on that ...thanks.
 
Tim,
you mean the date format difference, right?

Yes. When sending stuff to SQL, it's advisable to bypass all the regional
setting stuff and format the things yourself:

strWhere = "fldDate = " & Format$(Date(), "\#yyyy\-mm\-dd\#")
strWhere = strWhere & " AND ...."

rst.FindFirst strWhere

B Wishes


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top