Openrecordset with date criteria

E

Eric

I'm trying to open the following recordset with date criteria but I'm getting
an error message: (syntax error, mssing operator)

Set rstin = dbs.OpenRecordset("SELECT * FROM detailslinerental WHERE
TelephoneNumber = '" & f!TelephoneNumber & "' And [ItemStartDate] => #" &
rstsplit!startdate & "#")

Does anyone see what I'm doing wrong here? TIA
 
A

Allen Browne

Break it down into separate lines:
Dim strSql As String
strSql = "SELECT ...
Debug.Print strSql
Set rstin = dbs.OpenRecorset(strsql)

When it fails press Ctrl+G to open the Immediate window.
You'll probably see what's wrong with the SQL statement.
If not, copy it, and paste it into a new query (in SQL view.)

It may be that one of the values you are pasting in is Null, so the string
is malformed.
 

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

Top