Link to home
Start Free TrialLog in
Avatar of shieldsco
shieldscoFlag for United States of America

asked on

Access DLookup

I using the dlookup below however I get an error. Any thoughts.


=
DLookUp("Time Start","qryLastAuditLogDate","Time Start = " & [Time Start])

Open in new window

Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Try this.  And what is the error you are getting ?

DLookUp("Time Start","qryLastAuditLogDate","Time Start = " & "#" & [Time Start] & "#")
Avatar of shieldsco

ASKER

still get an error#
It's a lookup on a form... #error
Do you have
=DLookkup()

(equal sign in front of DLookup) ?

And where does [Time Start]  exist ?
Here's the sql
SELECT Max(tbl_Inactivity.[Time Start]) AS [MaxOfTime Start] FROM tbl_Inactivity;

Open in new window

(note the brackets around Time Start

=DLookUp("Time Start","qryLastAuditLogDate","[Time Start] = " & "#" & [MaxOfTime Start] & "#")

or

=DLookUp("Time Start","qryLastAuditLogDate","[Time Start] = " & [MaxOfTime Start])
Last Audit Log Date is lookup

User generated image
I get an error : #Name? on both
"Last Audit Log Date is lookup"
Not sure what you mean ?

You are using DLookup to grab a value from a query, right ?

Theses ... more brackets

=DLookUp("[Time Start]","qryLastAuditLogDate","[Time Start] = " & "#" & [MaxOfTime Start] & "#")

or

=DLookUp("[Time Start]","qryLastAuditLogDate","[Time Start] = " & [MaxOfTime Start])
User generated image
Yes using Dlookup to grab a value from a query. Tried both and get #Name?
If you run that SQL by itself, what does it return ?
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mitch Schwartz
Mitch Schwartz

Why not use DMAX, and do away with the query as the control's record source:

=DMAX("[Time Start]","tbl_Inactivity")
Thanks
Sorry for the confusion. It was late :-)
No problem Joe