Full Version: Dlookup Error With Date()
UtterAccess Forums > Microsoft® Access > Access Forms
classicxman
I have a form that provides a Begin Date and End Date covering the prior 52 week period. I have been using a DLookup function on a table called "fiscal dates" with no problems in the past. Today I am getting an error on these two fields in the form. Access is having an issue with my criteria "[Date] = Date()". I checked the table to make sure today's date exists and is valid. I can't see the problem. See attached for my formula and the error message. Any ideas? Thanks.
RAZMaddaz
In order to use the Date() function, I had to convert it using the CDate function. Try the following:
DLookUp("[Field]","[Table]","[Date] =CDate(Date())")
arnelgp
Make sure to put bracket on your "fiscal dates" table
DlookUp("[Prior Sat]","[Fiscal Dates]","[Date]=Date()")
RAZMaddaz
Congrads!!!! Glad we could help!
Just curious, did you try what I suggested?
RAZMaddaz
SOS_UA
By the way, you do NOT need to put the table name in square brackets. It is ONLY field names that need to be within the Domain Aggregate functions. The table name, even with spaces, only needs to be in quotes.
classicxman
No I didn't. It was bugging me as to why Date() was not working so I did a bit more Googling and found the issue usually has to do with References. In this case, I had uninstalled my Blackberry Desktop the prior day (which includes a Roxio component). I then used CCleaner to clean up my registry files and must have deleted a .dll file that Access had in it's reference library. When I removed the Reference, all was good.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.