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 / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Help with multiple Dcount condition

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tsuby@libero.it - 23 Jul 2006 17:58 GMT
Hi everybody,

as a change I am stuck with some code and I cannot make a Dcount
function work.

I have my Table with Customers (Tbl_Customers)
CustomerID. (text)
Name
Company
etc.

Then I have another Table with Orders by these Customers (Tbl_Orders)
CustomerID (Text)
OrderID (Text)
Cdxdix (text) which is some other data I have to insert about each
order. Many customers can have the same cdxdix.value, but only once.
etc.

Now whenever I enter data regarding one order, I need to make sure of
this and I thought of using a Dcount function, but I can't find a way
to do it right:

If DCount("*", "Tbl_Orders", "CustomerID='" & Me!CustomerID& "'" AND
"Cdxdix", "CustomerID", "Cdxdix='" & Me!Cdxdix & "'") > 1 Then
etc.

But I keep getting a "wrong number of arguments" error.

What am I doing wrong? Is Dcount the word way to go?

Thanks in advance for the help!

Erika
Al Camp - 23 Jul 2006 19:17 GMT
Erika,

> If DCount("*", "Tbl_Orders", "CustomerID='" & Me!CustomerID& "'" AND
> "Cdxdix", "CustomerID", "Cdxdix='" & Me!Cdxdix & "'") > 1 Then
> etc.

  The Dcount and criteriea need to be repeated...
ex.
  If Dcount(something) >1 And Dcount(something else) >1 Then....

Signature

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
There are 10 types of people in the world.
Those who understand binary, and those who don't.

> Hi everybody,
>
[quoted text clipped - 29 lines]
>
> Erika
Ami - 23 Jul 2006 19:59 GMT
Al Camp ha scritto:

> Erika,
>
[quoted text clipped - 5 lines]
> ex.
>    If Dcount(something) >1 And Dcount(something else) >1 Then....

Hi, I had already tried it this way, I get no error message, but
something is not working all the same, because whichever value I enter
in cdxdx field I keep getting an error message saying this is a
duplicate, even if I know for sure that there is no duplicate at all!

Since both records can be duplicated if alone, but not as a
combination, I thought I could put together the two conditions and
check them as a single dcount.

Any idea how I could accomplish this?

Thanks

Erika
 
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.