Is it possible to use 2 expressions in same filed in a Q?

N

Niklas Östergren

Hi!

Is it possible to use 2 expressions in the same field in a query?

What I would like is to get DMAX of a date but only for the dates that are
= Date().
Here is what I have:

DMax("[MemberShipEndDate]";"tblMemberValidation";"[tblMemberValidation].[fkM
emberID] = " & [MemberID])

I would like to get DMAX of field [MemberShipEndDate] but only for the dates
that are >= today´s date.

I have tried a couple of expressions, to join thes two but I don´t seems to
get it right!

TIA
// Niklas
 
J

John Vinson

Hi!

Is it possible to use 2 expressions in the same field in a query?

What I would like is to get DMAX of a date but only for the dates that are
= Date().
Here is what I have:

DMax("[MemberShipEndDate]";"tblMemberValidation";"[tblMemberValidation].[fkM
emberID] = " & [MemberID])

I would like to get DMAX of field [MemberShipEndDate] but only for the dates
that are >= today´s date.

Just use the Boolean logical operator AND:

DMax("[MemberShipEndDate]";"tblMemberValidation";"[tblMemberValidation].[fkM
emberID] = " & [MemberID] & " AND [MemberShipEndDate] > Date()")
 
N

Niklas Östergren

Thank´s a lot John!

I had tried with this (see below) but got an error:

DMax("([MemberShipEndDate]>=
Date())";"tblMemberValidation";"[tblMemberValidation].[fkM
emberID] = " & [MemberID] )

I tried with your answere and it worked, I just modifyed it a little to get
also today´s date!

Thanks a lot!

// Niklas
 
J

John Vinson

Thank´s a lot John!

I had tried with this (see below) but got an error:

DMax("([MemberShipEndDate]>=
Date())";"tblMemberValidation";"[tblMemberValidation].[fkM
emberID] = " & [MemberID] )

I tried with your answere and it worked, I just modifyed it a little to get
also today´s date!

This would in fact not have worked, because of the definition of the
arguments to DMax.

The first argument must be a text string containing the name of the
field for which you want the maximum value retrieved (you had an
expression, not a fieldname).

The second argument must be the name of a table or query from which to
get the field.

The third argument must be a text string containing a legal SQL WHERE
clause (which can contain multiple AND, OR, and other operators,
anything you could use in a regular SELECT query) which determines
which records to consider.
 

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