Help Dmax

E

ernie

Hi all,

How can i use dmax to get the latest field in a table?
I tried the code below but i get the autonumber field.
dmax("AutoFieldName","TableName")
 
K

Ken Snell \(MVP\)

Tell us what fields you have in the table. Is one of them a "date/time
stamp" field that records the date and time when the record was created?
What do you mean by the "latest field" -- don't you mean "latest record"?
 
E

ernie

I tried using the code below but no sucess.

SELECT (DMax("[Valuation_Assessment_ID]","[Valuation_Assessment]")),
[Valuation_Assessment].[LodgeNo] FROM [Valuation_Assessment] ORDER BY
[Valuation_Assessment].[LodgeNo];
 
A

Allen Browne

I think you are asking how you can get the value from another field in a
table, using the autonumber to determine which was the last record added?

If so, DMax() is not up to the task, and neither is DLookup().
There's an extended replacement for DLookup() here:
http://allenbrowne.com/ser-42.html
It will allow you to do something like:
=ELookup("MyOtherField", "MyTable", , "[MyAutonumber] DESC")
 
E

ernie

I Tried the this but no help

=ELookup("LodgeNo","Valuation_Assessment","Valuation_Assessment_ID")
--
help a friend help you


Allen Browne said:
I think you are asking how you can get the value from another field in a
table, using the autonumber to determine which was the last record added?

If so, DMax() is not up to the task, and neither is DLookup().
There's an extended replacement for DLookup() here:
http://allenbrowne.com/ser-42.html
It will allow you to do something like:
=ELookup("MyOtherField", "MyTable", , "[MyAutonumber] DESC")

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

ernie said:
Hi all,

How can i use dmax to get the latest field in a table?
I tried the code below but i get the autonumber field.
dmax("AutoFieldName","TableName")
 
E

ernie

Thanks for responding

I have a table name [Valuation Assessment] with fields: [DateEntered],
[TimeEntered], [LodgeNo]. All I need to do is to update a label on a form
showing the last [LodgeNo] that was Entered in the table.

I Appreciate your help
Thank You
 
A

Allen Browne

You omitted the space and DESC in the last argument (so it sorts in
descending order.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

ernie said:
I Tried the this but no help

=ELookup("LodgeNo","Valuation_Assessment","Valuation_Assessment_ID")
--
help a friend help you


Allen Browne said:
I think you are asking how you can get the value from another field in a
table, using the autonumber to determine which was the last record added?

If so, DMax() is not up to the task, and neither is DLookup().
There's an extended replacement for DLookup() here:
http://allenbrowne.com/ser-42.html
It will allow you to do something like:
=ELookup("MyOtherField", "MyTable", , "[MyAutonumber] DESC")

ernie said:
Hi all,

How can i use dmax to get the latest field in a table?
I tried the code below but i get the autonumber field.
dmax("AutoFieldName","TableName")
 
E

ernie

Thanks for the reply but it doesn't work. I tried adding the space and DESC
at the end but no help.


Allen Browne said:
You omitted the space and DESC in the last argument (so it sorts in
descending order.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

ernie said:
I Tried the this but no help

=ELookup("LodgeNo","Valuation_Assessment","Valuation_Assessment_ID")
--
help a friend help you


Allen Browne said:
I think you are asking how you can get the value from another field in a
table, using the autonumber to determine which was the last record added?

If so, DMax() is not up to the task, and neither is DLookup().
There's an extended replacement for DLookup() here:
http://allenbrowne.com/ser-42.html
It will allow you to do something like:
=ELookup("MyOtherField", "MyTable", , "[MyAutonumber] DESC")

Hi all,

How can i use dmax to get the latest field in a table?
I tried the code below but i get the autonumber field.
dmax("AutoFieldName","TableName")
 
A

Allen Browne

Your expression will returnr the value of the LodgeNo field from the
Validation_Assessment table for the record that has the highest
Validation_Assessment_ID.

If it's not doing that, I don't know what's going on on your pc.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

ernie said:
Thanks for the reply but it doesn't work. I tried adding the space and
DESC
at the end but no help.


Allen Browne said:
You omitted the space and DESC in the last argument (so it sorts in
descending order.)

ernie said:
I Tried the this but no help

=ELookup("LodgeNo","Valuation_Assessment","Valuation_Assessment_ID")
--
help a friend help you


:

I think you are asking how you can get the value from another field in
a
table, using the autonumber to determine which was the last record
added?

If so, DMax() is not up to the task, and neither is DLookup().
There's an extended replacement for DLookup() here:
http://allenbrowne.com/ser-42.html
It will allow you to do something like:
=ELookup("MyOtherField", "MyTable", , "[MyAutonumber] DESC")

Hi all,

How can i use dmax to get the latest field in a table?
I tried the code below but i get the autonumber field.
dmax("AutoFieldName","TableName")
 
E

ernie

I tried these codes below but the error "#Name?" was returned. I did a search
in the office help for elookup but didnt find anything. I'm using office 2003

=ELookup("[Valuation Assessment]!LodgeNo", "[Valuation Assessment]", ,
"[Valuation Assessment]!ID DESC")

=ELookup("LodgeNo","[Valuation Assessment]","[ID] DESC")

Thanks for your response


Allen Browne said:
Your expression will returnr the value of the LodgeNo field from the
Validation_Assessment table for the record that has the highest
Validation_Assessment_ID.

If it's not doing that, I don't know what's going on on your pc.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

ernie said:
Thanks for the reply but it doesn't work. I tried adding the space and
DESC
at the end but no help.


Allen Browne said:
You omitted the space and DESC in the last argument (so it sorts in
descending order.)

I Tried the this but no help

=ELookup("LodgeNo","Valuation_Assessment","Valuation_Assessment_ID")
--
help a friend help you


:

I think you are asking how you can get the value from another field in
a
table, using the autonumber to determine which was the last record
added?

If so, DMax() is not up to the task, and neither is DLookup().
There's an extended replacement for DLookup() here:
http://allenbrowne.com/ser-42.html
It will allow you to do something like:
=ELookup("MyOtherField", "MyTable", , "[MyAutonumber] DESC")

Hi all,

How can i use dmax to get the latest field in a table?
I tried the code below but i get the autonumber field.
dmax("AutoFieldName","TableName")
 
A

Allen Browne

The last one is missing a comma.

Try renaming the text box. It must not have the same name as any field in
the form's source table/query.

Could also be a problem with references:
http://allenbrowne.com/ser-38.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

ernie said:
I tried these codes below but the error "#Name?" was returned. I did a
search
in the office help for elookup but didnt find anything. I'm using office
2003

=ELookup("[Valuation Assessment]!LodgeNo", "[Valuation Assessment]", ,
"[Valuation Assessment]!ID DESC")

=ELookup("LodgeNo","[Valuation Assessment]","[ID] DESC")

Thanks for your response


Allen Browne said:
Your expression will returnr the value of the LodgeNo field from the
Validation_Assessment table for the record that has the highest
Validation_Assessment_ID.

If it's not doing that, I don't know what's going on on your pc.

ernie said:
Thanks for the reply but it doesn't work. I tried adding the space and
DESC
at the end but no help.


:

You omitted the space and DESC in the last argument (so it sorts in
descending order.)

I Tried the this but no help

=ELookup("LodgeNo","Valuation_Assessment","Valuation_Assessment_ID")
--
help a friend help you


:

I think you are asking how you can get the value from another field
in
a
table, using the autonumber to determine which was the last record
added?

If so, DMax() is not up to the task, and neither is DLookup().
There's an extended replacement for DLookup() here:
http://allenbrowne.com/ser-42.html
It will allow you to do something like:
=ELookup("MyOtherField", "MyTable", , "[MyAutonumber] DESC")

Hi all,

How can i use dmax to get the latest field in a table?
I tried the code below but i get the autonumber field.
dmax("AutoFieldName","TableName")
 
E

ernie

Hi Allen

Thank you so much for all your response. I didnt get the elookup to work
though i tried it so many different ways. with and without the extra comma
and with and without the "DESC" at the end. But i did get something to work.

I use the code: in a text box named "Text53" and made it invisible then,
=(DMax("[Valuation Assessment]!ID","[Valuation Assessment]"))

I use the Dlookup function in this code to solve my problem
=DLookUp("LodgeNo","[Valuation Assessment]","[ID] = Text53")

Thanks Again

Allen Browne said:
The last one is missing a comma.

Try renaming the text box. It must not have the same name as any field in
the form's source table/query.

Could also be a problem with references:
http://allenbrowne.com/ser-38.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

ernie said:
I tried these codes below but the error "#Name?" was returned. I did a
search
in the office help for elookup but didnt find anything. I'm using office
2003

=ELookup("[Valuation Assessment]!LodgeNo", "[Valuation Assessment]", ,
"[Valuation Assessment]!ID DESC")

=ELookup("LodgeNo","[Valuation Assessment]","[ID] DESC")

Thanks for your response


Allen Browne said:
Your expression will returnr the value of the LodgeNo field from the
Validation_Assessment table for the record that has the highest
Validation_Assessment_ID.

If it's not doing that, I don't know what's going on on your pc.

Thanks for the reply but it doesn't work. I tried adding the space and
DESC
at the end but no help.


:

You omitted the space and DESC in the last argument (so it sorts in
descending order.)

I Tried the this but no help

=ELookup("LodgeNo","Valuation_Assessment","Valuation_Assessment_ID")
--
help a friend help you


:

I think you are asking how you can get the value from another field
in
a
table, using the autonumber to determine which was the last record
added?

If so, DMax() is not up to the task, and neither is DLookup().
There's an extended replacement for DLookup() here:
http://allenbrowne.com/ser-42.html
It will allow you to do something like:
=ELookup("MyOtherField", "MyTable", , "[MyAutonumber] DESC")

Hi all,

How can i use dmax to get the latest field in a table?
I tried the code below but i get the autonumber field.
dmax("AutoFieldName","TableName")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top