WHERE Clause on Date's in OpenRecordset

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

I am getting syntax errors on the Statement below. Tried
different things, what am I donig wrong?

Set rst = db.OpenRecordset("SELECT * FROM Games WHERE
GameDt > #DateOfFilm#"

DateOfFilm is a Date Field Variable that is assembled from
various information criteria.


Thank You

Tony Zine
 
Set rst = db.OpenRecordset("SELECT * FROM Games WHERE GameDt > #" &
DateOfFilm & "#;", rest of openrecordset statement)

You need to break the variable out of the quoted string so that VBA will see
it as a variable and not as just part of the string.
 
Set rst = db.OpenRecordset("SELECT * FROM Games WHERE GameDt > " & _
Format(DateOfFilm, "\#mm\/dd\/yyyy\#"))
 
I am getting syntax errors on the Statement below. Tried
different things, what am I donig wrong?

Set rst = db.OpenRecordset("SELECT * FROM Games WHERE
GameDt > #DateOfFilm#"

DateOfFilm is a Date Field Variable that is assembled from
various information criteria.

DateOfFilm might be a valid variable, but #DateOfFilm# isn't.

Concatenate the variable value with a valid string:

Set rst = db.OpenRecordset("SELECT * FROM Games WHERE
GameDt > #" & DateOfFilm & "#")
 
Back
Top