Solved

Access DLookup

Posted on 2016-10-01
18
37 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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 - Access MVP) 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

803 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