Count Number of Deposits

D

Dave Elliott

I have a form where I enter deposits.
There are 10 fields to add up (Deposit Amounts)
Cust1 Thru Cust9 Plus a single Cash Deposit named Cash
Cust1
Cust2
etc...
Cash


Equals total number of deposits

How can I count the number of deposits in a textbox that equal Cust1 Thru
Cust9 Plus Cash?
 
R

Rick B

Your structure is allll wrong here. You have a one-to-many relationship
here. One customer and up to ten deposits. You should have a table with
four fields, Customer, DepositAmount, DepositType, and DepositDate.

You'd most likely have other tables to define your customer information and
other important items.

Then you could create queries and reports to pull deposits and sum them and
count them.

Rick B
 
D

Dave Elliott

Well, maybe I could have set it up better, however it works fine like it is
except , I have to manualy
enter the total number of deposits.
Is there a DCount code that I could use to perform the calculation?
 
S

Steve Schapel

Dave,

I am not really sure what you mean, on the basis of the information you
have provided so far, but would this do the job?...
Put a calculated field in a query, like this...
TotalDeposits: [Cust1]+[Cust2]+[Cust3]+...+[Cust9]+[Cash]
 
D

Dave Elliott

Cust1, etc... are all textboxes with deposits in them.i.e. Cust1
=$50.00+Cust2=$0.00 , etc...

Need the COUNT of these. Cust1 would equal 1 + Cust2 if it is>0 ='s a
Count of 2, etc...



Steve Schapel said:
Dave,

I am not really sure what you mean, on the basis of the information you
have provided so far, but would this do the job?...
Put a calculated field in a query, like this...
TotalDeposits: [Cust1]+[Cust2]+[Cust3]+...+[Cust9]+[Cash]

--
Steve Schapel, Microsoft Access MVP


Dave said:
Well, maybe I could have set it up better, however it works fine like it
is except , I have to manualy
enter the total number of deposits.
Is there a DCount code that I could use to perform the calculation?
 
D

Dave Elliott

If Cust1>0 Then it equals a COUNT of 1
If Cust2>0 Then the COUNT would be 2
etc...

Steve Schapel said:
Dave,

I am not really sure what you mean, on the basis of the information you
have provided so far, but would this do the job?...
Put a calculated field in a query, like this...
TotalDeposits: [Cust1]+[Cust2]+[Cust3]+...+[Cust9]+[Cash]

--
Steve Schapel, Microsoft Access MVP


Dave said:
Well, maybe I could have set it up better, however it works fine like it
is except , I have to manualy
enter the total number of deposits.
Is there a DCount code that I could use to perform the calculation?
 
S

Steve Schapel

Dave,

Ok, thanks for the further information, it certainly helps to understand
the question. Try this...
TotalDeposits: Abs(([Cust1]>0)+([Cust2]>0)+...+([Cust9]>0)+([Cash]>0))
 
D

Dave Elliott

Thanks, this is the final code, but I get a #errror ????????????

=Abs(([Cust1]>0)+([Cust2]>0)+([Cust3]>0)+([Cust4]>0)+([Cust5]>0)+([Cust6]>0)+([Cust7]>0)+([Cust8]>0)+([Cust9]>0)+([Cash]>0))



Steve Schapel said:
Dave,

Ok, thanks for the further information, it certainly helps to understand
the question. Try this...
TotalDeposits: Abs(([Cust1]>0)+([Cust2]>0)+...+([Cust9]>0)+([Cash]>0))

--
Steve Schapel, Microsoft Access MVP

Dave said:
If Cust1>0 Then it equals a COUNT of 1
If Cust2>0 Then the COUNT would be 2
etc...
 
D

Dave Elliott

Thanks, Everything works

Steve Schapel said:
Dave,

Ok, thanks for the further information, it certainly helps to understand
the question. Try this...
TotalDeposits: Abs(([Cust1]>0)+([Cust2]>0)+...+([Cust9]>0)+([Cash]>0))

--
Steve Schapel, Microsoft Access MVP

Dave said:
If Cust1>0 Then it equals a COUNT of 1
If Cust2>0 Then the COUNT would be 2
etc...
 

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