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

:)

commented: Well done in solving this for yourself.:) +6

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.;)

@AndreRet : alleybye learn much about date from u, i think ;)

Thanks JX.:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.