please help me!
im doing a date comparing project where in i compare the expiration date and the current date

i put this on the general

dim mydate as string

then at the formload

mydate = format(now,"mm/dd/yyyy")

and also on my database id format the Expiration field as Date with format mm/dd/yyyy

heres my code for the comparing

rs.Open "SELECT Expiration FROM tblInventory WHERE Expiration < '" & mydate & "', con, adOpenStatic, adLockOptimistic

but ive got this error

'Data type mismatch on criteria expression.'

can someone help me solving this problem?
please :(

thanks in advance!

got it :)

rs1.Open "SELECT Expiration FROM tblInventory WHERE Expiration < #" & mydate & "#", con, adOpenStatic, adLockOptimistic

:)

Comments
Well done in solving this for yourself.:)

You've beaten me to this.;) When using date formats, include the "#" character OR as my previous posts, DateValue().:)

Well done, some kudos for solving yourself.

Please mark this as solved, found at the bottom of this page, thanks. Happy coding.;)

This question has already been answered. Start a new discussion instead.