DMax with more criterias (1 Viewer)

omaggi

Registered User.
Local time
Yesterday, 22:53
Joined
Oct 19, 2009
Messages
43
Hi Everybody.
I'm trying to build a Dmax function that include more criteria. But I have some problems.

Here I post the 2 DMax function:

DMax("age", "data", "[id_name] = " & Me.ccName)
DMax("age", "data", "[id_address] = " & Me.ccAddress)

I need that the 2 are together so I will receive as output the record the the max age with these 2 criterias...

Thanks for any help.

Greetings.
 

boblarson

Smeghead
Local time
Yesterday, 22:53
Joined
Jan 12, 2001
Messages
32,059
If id_name and id_address are text fields:
Code:
DMax("age", "data", "[id_name] = " & Chr(34) & Me.ccName & Chr(34) & " And [id_address] = " & Chr(34) &  Me.ccAddress & Chr(34))
 

omaggi

Registered User.
Local time
Yesterday, 22:53
Joined
Oct 19, 2009
Messages
43
Thanks, I tried but doesnt work...

If I write the 2 functions DMax separate, works good but I need absolutly to concat the 2 functions together...If not I don't have the right value in output...

Any other suggestions?
 

boblarson

Smeghead
Local time
Yesterday, 22:53
Joined
Jan 12, 2001
Messages
32,059
Well, the code I showed is correct. I looked back at it just in case. Can you post what code you are trying to use (after concatenating)?
 

omaggi

Registered User.
Local time
Yesterday, 22:53
Joined
Oct 19, 2009
Messages
43
I use the code you posted...but I have an error about type of data...
 

boblarson

Smeghead
Local time
Yesterday, 22:53
Joined
Jan 12, 2001
Messages
32,059
Oh, and are these controls TEXT boxes or COMBO boxes?

Me.ccName
Me.ccAddress
 

boblarson

Smeghead
Local time
Yesterday, 22:53
Joined
Jan 12, 2001
Messages
32,059
Ah, so go ahead and see if this works without the Chr(34).

DMax("age", "data", "[id_name] = " & Me.ccName & " And [id_address] = " & Me.ccAddress)
 

omaggi

Registered User.
Local time
Yesterday, 22:53
Joined
Oct 19, 2009
Messages
43
Thanks now it works!!!

Thank you so much.

Greetings.
 

Users who are viewing this thread

Top Bottom