DlookUp Problem (1 Viewer)

JRMT

New member
Local time
Today, 12:24
Joined
Dec 3, 2020
Messages
23
Code:
=Nz(DLookUp("[Date Last Change]","FndLstBatCge20")) & Nz(DLookUp("[Date Last Change]","FndLstBatCge21"))
Hi Sir's just want advice from experts the above code works perfectly when there is only 1 record Dates from these Query FndLstBatCge20 & FndLstBatCge21
However if there are 1 records on each Query it display both values in a form. what i want is to only display the latest Date last change to show in Form even if the 2 query have both Date records. what will i add to my current Code Sir's?
this code is in a control source of my Form Field.
Thank you!!!
 

plog

Banishment Pending
Local time
Today, 04:24
Joined
May 11, 2011
Messages
11,638
I would rewrite the queries into 1 query such that they return just 1 value. Most likely using MAX().

Can you post the SQL of the 2 queries?
 

JRMT

New member
Local time
Today, 12:24
Joined
Dec 3, 2020
Messages
23
I would rewrite the queries into 1 query such that they return just 1 value. Most likely using MAX().

Can you post the SQL of the 2 queries?
Im Sorry Sir but i dont want to return 1 value in my 2 queries Sir. i just want to display the latest date last changed in a form even if they Both have values using Dlookup Sir.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:24
Joined
Oct 29, 2018
Messages
21,454
Hi. Would using DMax() rather than DLookup() work for you?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:24
Joined
Oct 29, 2018
Messages
21,454
Sir How Can i use the Dmax()? can i just replace the DlookUp in my current code?
Sure. Give that a try and let us know what happens.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:24
Joined
Oct 29, 2018
Messages
21,454
Still the Same Sir it Display two Date Values 1 in query FndLstBatCge20 and 1 in FndLstBatCge21 :(
Can you show us your query's SQL statement?
 

Users who are viewing this thread

Top Bottom