troubleshooting Question

Check if the date selected is found in a table in access-Need right sytex

Avatar of Sivasan
SivasanFlag for United States of America asked on
Microsoft Access
5 Comments1 Solution296 ViewsLast Modified:
Hi There,

In an click event in an access form, I'm checking to see a date entered in the form is found in a year table, if
so I perform certain function. I see that though the date is present in the table, the code doesn't catch it. I believe I'm using the wrong syntex when I check for the date.

Dim Ndate As Date
Ndate = CDate(Format(Me.enterdate, "mm/dd/yyyy"))
Set rs = CurrentDb.OpenRecordset("select * from Yeartbl where Working = " & Ndate)

If rs.EOF = True Then
 ' The condition for end of record true gets executed

' condition for date present gets executed.

I see that always
 ' The condition for end of record true gets executed
even if date is present in yeartbl.
I'm guessing & Ndate is not the right syntex. I will appreciate if somebody can tell me the right one.
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros