Using DMax with DLookUp

G

Gordon

Hi,

This is probably very simple but it's got me stumped. I am using the
following as the control source for an unbound text box:

=DLookUp("fldVersionNoAndDate","tblConstants",
[fldConstantID]=DMax("[fldConstantID]","tblConstants")).

Access (97) gives me syntax error when I enter the above, but I'm
getting a "#Name?" error in the form control.

Can someone point out my (glaring?) error?

Thanks

Gordon
 
D

Douglas J. Steele

Your quotes are wrong.

=DLookUp("fldVersionNoAndDate","tblConstants",
"[fldConstantID]=" & DMax("[fldConstantID]","tblConstants"))

This assumes that fldConstantID is a numeric field. It it's text:

=DLookUp("fldVersionNoAndDate","tblConstants",
"[fldConstantID]='" & DMax("[fldConstantID]","tblConstants") & "'")

Exagerated for clarity, that's

=DLookUp("fldVersionNoAndDate","tblConstants",
"[fldConstantID]= ' " & DMax("[fldConstantID]","tblConstants") & " ' ")
 

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