Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / November 2004

Tip: Looking for answers? Try searching our database.

DCount problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul T. RONG - 30 Nov 2004 16:46 GMT
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
Dave M - 30 Nov 2004 17:14 GMT
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

> Hi,
>
[quoted text clipped - 8 lines]
>
> Paul
Paul T. RONG - 30 Nov 2004 20:39 GMT
Dave,

Thank you very much. It works very well.

Paul

"Dave M" <dmacmurc@island.net> ????????????
:NT1rd.388827$nl.180856@pd7tw3no...
> The WHERE part of the DCount is a string, and as you have it the string is
[quoted text clipped - 30 lines]
> >
> > Paul
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.