DMax returning #Error (1 Viewer)

wdrspens

Registered User.
Local time
Today, 06:00
Joined
Jun 19, 2008
Messages
63
Can anyone see the error I am getting in this expression in a query:

LastNo: DMax("[BookingFormNo]","DetailNewQuery","[Organisation] = " & [Organisation])

I have a [BookingFormNo] field in the "DetailNewQuery" Query which also has an [Organisation] field. There are about 40 Organisations.

What I am trying to do is get the latest BookingFormNo for the relevant Organisation, but all I get is #Error.

It is the last expression that is causing the problem, because if I enter "[Organisation] = 'Bridge Club'" it works perfectly.

Any ideas

Thanks

David
 

HiTechCoach

Well-known member
Local time
Today, 00:00
Joined
Mar 6, 2006
Messages
4,357
Can anyone see the error I am getting in this expression in a query:

LastNo: DMax("[BookingFormNo]","DetailNewQuery","[Organisation] = " & [Organisation])

I have a [BookingFormNo] field in the "DetailNewQuery" Query which also has an [Organisation] field. There are about 40 Organisations.

What I am trying to do is get the latest BookingFormNo for the relevant Organisation, but all I get is #Error.

It is the last expression that is causing the problem, because if I enter "[Organisation] = 'Bridge Club'" it works perfectly.

Any ideas

Thanks

David

Try this:

Code:
LastNo: DMax("[BookingFormNo]","DetailNewQuery","[Organisation] = " & Chr(34) & [Organisation] & Chr(34) )
 

wdrspens

Registered User.
Local time
Today, 06:00
Joined
Jun 19, 2008
Messages
63
Thanks Boyd,

Brilliant, it is just what I wanted, thank you very much.

David

It seems odd that that is not suggested in the help file examples produced by Microsoft!
 

Users who are viewing this thread

Top Bottom