The WHERE part of the DCount is a string, and as you have it the string is
"DCount("[OrderDetailID]", "qryOrder", "([OrderID] = Me![OrderID] AND
[CatID]
= 'drink')" > 0
"
If the OrderID in question is, say, 42, what you really want is
DCount("[OrderDetailID]", "qryOrder", "([OrderID] = 42 AND [CatID]
= 'drink')" > 0
To get this, you need to put the reference to the control outside the
string, so that the value in the control gets used instead of the reference
to it:
DCount("[OrderDetailID]", "qryOrder", "([OrderID] = " & Me![OrderID] & " AND
[CatID]
= 'drink')" > 0
"Paul T. RONG" <et***@hotmail.com> wrote in message
news:nt******************@news.chello.at...
Hi,
I have a problem with DCount, the following code doesn't work:
DCount("[OrderDetailID]", "qryOrder", "([OrderID] = Me![OrderID] AND
[CatID] = 'drink')" > 0
Please help.
Thank you.
Paul