winter -> Account Expires DRW problem (6/2/2009 11:17:18)
Hi All - I am having a challenge with creating a drw return on records from my spooky login DB program. I would like to have a list of members whose accounts have expired between 2 dates. I used the FP003 wizard to create this and then put the .asp page on the spooky diet.
Here is the line in question: <% fp_sQry="SELECT * FROM Users WHERE (AccountExpires > '1/1/2005' AND AccountExpires < '12/31/2006') ORDER BY AccountExpires ASC,AccessLevel ASC,x_Lastname ASC"
The error returned says: Database Results Wizard Error Description: Data type mismatch in criteria expression. Number: -2147217913 (0x80040E07) Source: Microsoft JET Database Engine
I tried putting double quotes around the dates and when that didn't work I put double and single quotes around each date - with the more specific error message of an Error due to syntax at AccountExpires.
What am I missing? [8|]
Thanks soooo much
Carolyn
TexasWebDevelopers -> RE: Account Expires DRW problem (6/2/2009 12:02:00)
Access database? Try hashmarks around dates: fp_sQry="SELECT * FROM Users WHERE (AccountExpires > #1/1/2005# AND AccountExpires < #12/31/2006#) ORDER BY AccountExpires ASC,AccessLevel ASC,x_Lastname ASC"
winter -> RE: Account Expires DRW problem (6/2/2009 14:43:27)
Thanks so much for the suggestion which i have just tried. It generates a new error:
"Database Results Wizard Error Description: Command text was not set for the command object."
Have no idea what that means. Is it possible that the hash marks also need quotes? Single or double?
Ideas welcomed!
Carolyn
TexasWebDevelopers -> RE: Account Expires DRW problem (6/2/2009 18:37:14)
Well, ya' can't break anything...I think you are correct, single quotes around the hashes
Spooky -> RE: Account Expires DRW problem (6/2/2009 18:52:28)
Try this?
fp_sQry="SELECT * FROM Users WHERE (AccountExpires BETWEEN #1/1/2005# AND #12/31/2006#) ORDER BY AccountExpires ASC,AccessLevel ASC,x_Lastname ASC"
With dates, in Access you can use #
winter -> RE: Account Expires DRW problem (6/2/2009 19:51:10)
My goodness! Thank you both!!! It was the word BETWEEN that was missing and I had no idea that it should go there. The code works perfectly.