Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of a variable in a Select Where statement

Status
Not open for further replies.

LarryViles

Programmer
Jul 1, 2009
2
US
In Access 2003 I have the following statement as part of a report. I wish to change the literal '8' to a more user friendly variable (like ThisMonth). Every attempt to do so results in an error message.

rst.Open "SELECT [Birthday Query Sub].[1stResident], DatePart('d',[1stBirthday]) AS Birthdate FROM [Birthday Query Sub] WHERE (((DatePart('m', [1stBirthday])) = 8)) ORDER BY DatePart('d',[1stBirthday]);"

Larry
 
Did you try

?ThisMonth

If it would not work (I'm just guessing here) then try asking your question in Access forum.
 
This definitely belongs in the Access forums, but FYI your variable ThisMonth should be dimmed as Date, and use the date delimiter # like this:
#ThisMonth#

Illegitimi non carborundum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top