Solved Expression Builder Latest Date in Forms (1 Viewer)

ardy

Registered User.
Local time
Today, 01:01
Joined
Sep 24, 2012
Messages
98
Hello All,
I am trying to use the expression builder to get the latest date in a table in a form inside an unbound text box utilizing DLookUp. Have tried a bunch of different syntax options of the same formula.o_O None are working what am I doing wrong..... Any help is appreciated....

Code:
=DLookUp([Sample Date],"DDW_Import","[Smaple Date]=#" & Format(DMax("[Sample Date]","DDW_Import"),"mm/dd/yyyy") & "#")
 

Ranman256

Well-known member
Local time
Today, 04:01
Joined
Apr 9, 2015
Messages
4,337
It looks like youre looking it up twice.
can you just use: DMax("[Sample Date]","DDW_Import")
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:01
Joined
Sep 21, 2011
Messages
14,301
Just use DMax()
 

ardy

Registered User.
Local time
Today, 01:01
Joined
Sep 24, 2012
Messages
98
It gives me #Name? Error.....
Code:
DMax("[Sample Date]","DDW_Import")
 

CJ_London

Super Moderator
Staff member
Local time
Today, 09:01
Joined
Feb 19, 2013
Messages
16,612
So either the field or table name is spelt incorrectly
 

ardy

Registered User.
Local time
Today, 01:01
Joined
Sep 24, 2012
Messages
98
As far As I can see/tell they are correct....
1700262208955.png

1700262219048.png
 

CJ_London

Super Moderator
Staff member
Local time
Today, 09:01
Joined
Feb 19, 2013
Messages
16,612
Have you got an = in front of the dmax? As you have in post #1
 

AccessBlaster

Registered User.
Local time
Today, 01:01
Joined
May 22, 2010
Messages
5,953
Hello All,
I am trying to use the expression builder to get the latest date in a table in a form inside an unbound text box utilizing DLookUp. Have tried a bunch of different syntax options of the same formula.o_O None are working what am I doing wrong..... Any help is appreciated....

Code:
=DLookUp([Sample Date],"DDW_Import","[Smaple Date]=#" & Format(DMax("[Sample Date]","DDW_Import"),"mm/dd/yyyy") & "#")
[Sample date] is misspelled in the second instance
 

Oviziest

New member
Local time
Today, 01:01
Joined
Nov 13, 2023
Messages
5
Looks like you're trying to fetch the latest date from a table into an unbound text box using the expression builder. Sometimes, getting the syntax right can be tricky. Double-check if the table name and field are spelled correctly in your DLookUp formula. Maybe that's where things are going a bit wonky
 

ardy

Registered User.
Local time
Today, 01:01
Joined
Sep 24, 2012
Messages
98
Thank you all for responding...... I Do Appreciate it.

@CJ_London
You are right I was missing the "=". How I miss that is a dilemma, but you look at something for hours the simplest things are missing. So " =DMax("[Sample Date]","DDW_Import") works and I can get the show on the road. thank you for pointing that out.

@AccessBlaster
Yes, you are right I misspelled the Sample Date. Correct it but it still didn't work. That is a dilemma for me on a personal note. I most likely will play around with this and resolve it one of these days. for now the above gets my show on the road.

@Oviziest
I also think that is the syntax issue, Access gets finicky with that. As I said I will see if I can get it right by trying different combinations when time allows, for now, the simple expression(above) works.

@Gasman
No, it's not the caption. I use them sometimes in different projects, but didn't use them in this one.

All and all I want to thank all of you for the responses.
 

Users who are viewing this thread

Top Bottom