473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

DCount problem

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
Nov 13 '05 #1
2 1912
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

Nov 13 '05 #2
Dave,

Thank you very much. It works very well.

Paul

"Dave M" <dm******@island.net> дÈëÏûÏ¢ÐÂÎÅ
:NT1rd.388827$nl.180856@pd7tw3no...
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


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Classified | last post by:
Hey There, Have a problem, hopefully someone out here can lend me a hand. Working on an appointment databases, haven't used VBA in ages and I am find a lot of rust everywhere. What I'm...
7
by: jdph40 | last post by:
I posted this problem previously and received excellent help from Wayne Morgan. However, I still have an unanswered question. My form (frmVacationWeeks) is opened from the OnClick event of a...
1
by: Megan | last post by:
Hi Everybody- I've been reading some of the posts about DCOUNT, and I haven't yet found an answer; so, I'm posting this question. I have a report that I'm trying to use DCOUNT on to compute...
4
by: Will | last post by:
Hi, I had a DCount within a module on records in a table where CustSuffix = 0. I now need to DCount where CustSuffix = 0 and the type of cost Suffix (Suffix in table) = G. I can't get both...
6
by: Mike Conklin | last post by:
This one really has me going. Probably something silly. I'm using dcount for a report to determine the number of different types of tests proctored in a semester. My report is based on a...
6
by: jstaggs39 | last post by:
I want to create a Dcount and an If...Then...Else statement to count the number of records in a table based on the date that is entered to run the form. The If....Else statment comes in because if...
2
by: Wingz | last post by:
Hiya, Fairly new to Access and was wondering what the best way to perform Dcounts on groups in an Access report. For example, I have 10 employees and the different instances of jobs they can...
5
by: neelesh kumar | last post by:
sir, i am struggling with a problem in my code.The code is Dim subcode as Variant,intnoofsubquestions(4) as integer,i as integer subcode = Array("ma","phy","che","ece") 'Msgbox myArray(2)...
3
by: davidwelli | last post by:
Hello, All help is appreciated, I'm struggling with the following. Using Access 2003 (front end) connecting to Oracle 7 database (back end). I'm trying to create a query in access that will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.