Help with multiple Dcount condition

T

tsuby

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
 
A

Al Camp

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

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

Ami

Al Camp ha scritto:
Erika,


The Dcount and criteriea need to be repeated...
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top