Solved

Access DLookup

Posted on 2016-10-01
18
46 Views
Last Modified: 2016-10-02
I using the dlookup below however I get an error. Any thoughts.


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

Open in new window

0
Comment
Question by:shieldsco
  • 9
  • 8
18 Comments
 
LVL 75
ID: 41825123
Try this.  And what is the error you are getting ?

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

Author Comment

by:shieldsco
ID: 41825130
still get an error#
0
 
LVL 75
ID: 41825134
What is the error number ?
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:shieldsco
ID: 41825137
It's a lookup on a form... #error
0
 
LVL 75
ID: 41825140
Do you have
=DLookkup()

(equal sign in front of DLookup) ?

And where does [Time Start]  exist ?
0
 

Author Comment

by:shieldsco
ID: 41825149
Here's the sql
SELECT Max(tbl_Inactivity.[Time Start]) AS [MaxOfTime Start] FROM tbl_Inactivity;

Open in new window

0
 
LVL 75
ID: 41825152
(note the brackets around Time Start

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

or

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

Author Comment

by:shieldsco
ID: 41825153
Last Audit Log Date is lookup

Last Audit Log Date:
0
 

Author Comment

by:shieldsco
ID: 41825155
I get an error : #Name? on both
0
 
LVL 75
ID: 41825160
"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])
0
 

Author Comment

by:shieldsco
ID: 41825161
View
0
 

Author Comment

by:shieldsco
ID: 41825162
Yes using Dlookup to grab a value from a query. Tried both and get #Name?
0
 
LVL 75
ID: 41825164
If you run that SQL by itself, what does it return ?
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 41825165
Wait ... that SQL is only returning one value ... so this is all you should need

=DLookUp("[MaxOfTime Start]","qryLastAuditLogDate")
0
 
LVL 1

Expert Comment

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

=DMAX("[Time Start]","tbl_Inactivity")
0
 

Author Closing Comment

by:shieldsco
ID: 41825387
Thanks
0
 
LVL 75
ID: 41825515
Sorry for the confusion. It was late :-)
0
 

Author Comment

by:shieldsco
ID: 41825532
No problem Joe
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question