dbTalk Databases Forums  

DCount problem

comp.databases.ms-access comp.databases.ms-access


Discuss DCount problem in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Paul T. RONG
 
Posts: n/a

Default DCount problem - 11-30-2004 , 10:46 AM






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



Reply With Quote
  #2  
Old   
Dave M
 
Posts: n/a

Default Re: DCount problem - 11-30-2004 , 11:14 AM






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" <etjsk (AT) hotmail (DOT) com> wrote

Quote:
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





Reply With Quote
  #3  
Old   
Paul T. RONG
 
Posts: n/a

Default Re: DCount problem - 11-30-2004 , 02:39 PM



Dave,

Thank you very much. It works very well.

Paul

"Dave M" <dmacmurc (AT) island (DOT) net> 写入消息新闻
:NT1rd.388827$nl.180856 (AT) pd7tw3no (DOT) ..
Quote:
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" <etjsk (AT) hotmail (DOT) com> wrote in message
news:nt1rd.55627$ha.16262 (AT) news (DOT) 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







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.