Jump to content

Date Clash with Query


Recommended Posts



The block of code that is giving me fits.


DTS = Date() - 7
DTS = FormatDateTime(DTS, 2)
Set GuildEvents = Server.CreateObject("ADODB.Recordset")
SQLQuery = "SELECT * FROM EVENTS WHERE EventDate > '"& DTS &"' ORDER BY EventDate"
Set GuildEvents = Conn.Execute(SQLQuery)
This is not working. For some reason, I am getting the following error:

Microsoft Office Access Database Engine error '80040e07'

Data type mismatch in criteria expression.

/va/calendar.asp, line 10

Now, my understanding is because the database stored the data in the EventDate as Date/Time. But I used Short Date for the type (using MS Access).

Can't figure out why the mismatch.

Help please.


Link to comment
Share on other sites

I figured that issue out. I was querying short date but I had faile to set short date n the table. So I was getting date and time (having stored Now() as the date sent in the form that made the record. Once I fixed that, everything was working.


Thanks for the post tho.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...