access 2007 accountancy application

K

kofmf

I am a real newbe, please be patient
I need to make a small accountancy application, but I'm confused.
I make a form that enter data in a table, for exemple yesterday I entered
in the debit of cash account 100, today I enter in the credit section of the
same cash account 20, so now in the cash account there is 80. With excel it
is easy, but I can't query
OK. How I can obtain this calculation in access?
Thanks to everebody
 
A

Al Campagna

kofmf,
Well, actually... your example has a balance of -80
Debits are subtractions, and Credits are additions.

You'll have a ONE Checkbook table associated to MANY Transactions
in a Transaction table.


Use just one table to handle both your debits and credits.
[TransID] [Description] [Credit] [Debit]
1 Deposit 100 0
2 Rental 0 40

The current balance would ... + 60
The sum of all Credits - the sum of all Debits
= Sum(Credit) - Sum(Debit)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
K

kofmf

Hi Al
Thank for your reply, but:
I would like to see the balance in every row and there is another little
problem, the starting balance

[TransID] [Date] [Description] [Credit] [Debit] [Balance]
1 09/01/01 start balance 30
30
2 09/01/13 deposit 100
130
3 09/02/14 payment 50
80

How can I see in a report or in a query the balance per every row?

Thank again to everybody


Al Campagna said:
kofmf,
Well, actually... your example has a balance of -80
Debits are subtractions, and Credits are additions.

You'll have a ONE Checkbook table associated to MANY Transactions
in a Transaction table.


Use just one table to handle both your debits and credits.
[TransID] [Description] [Credit] [Debit]
1 Deposit 100 0
2 Rental 0 40

The current balance would ... + 60
The sum of all Credits - the sum of all Debits
= Sum(Credit) - Sum(Debit)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

kofmf said:
I am a real newbe, please be patient
I need to make a small accountancy application, but I'm confused.
I make a form that enter data in a table, for exemple yesterday I entered
in the debit of cash account 100, today I enter in the credit section of
the
same cash account 20, so now in the cash account there is 80. With excel
it
is easy, but I can't query
OK. How I can obtain this calculation in access?
Thanks to everebody


.
 
K

kofmf

Thanks Ken for help
The explanations were clear, but formula was less clear
Tables, queries, reports, forms are easy when I read a book, but they are
very difficult when I must use in practice.
I MUST improve my knowledge of Access and English too.
Thanks again for the help

KenSheridan via AccessMonster.com said:
You can compute the sum of credits to date and the sum of debits to date in
subqueries and subtract the latter from the former to give the balance. As
there could be more than one transaction on one day, then you also need to
bring the TransID into play to arbitrarily sort the rows on this column
within each day, so the query is like this:

SELECT TransID, T1.Date, Description, Credit, Debit,
(SELECT SUM(Credit)
FROM Transactions AS T2
WHERE T2.Date <= T1.Date
AND ( T2.TransID <= T1.TransID
OR T2.Date <> T1.Date)) -
(SELECT SUM(Debit)
FROM Transactions AS T2
WHERE T2.Date <= T1.Date
AND ( T2.TransID <= T1.TransID
OR T2.Date <> T1.Date)) AS Balance
FROM Transactions AS T1
ORDER BY T1.Date DESC, TransID DESC;

The query is sorted in descending date order, which is normal for financial
statements, but if you wish you can sort it in ascending date order by
changing the last line to:

ORDER BY T1.Date, TransID;

If using the query as the RecordSource of a report, however, then omit the
ORDER BY clause and use the report's internal sorting and grouping mechanism
to sort it. Reports do not always respect the ORDER BY clause of a query.

BTW I'd recommend against using Date as a column name. It’s the name of a
built in function, so could cause confusion and give the wrong results in
some circumstances. Use something more specific like TransDate. Qualifying
it with the table name (or alias in the above case as aliases T1 and T2 are
used to differentiate the separate instances of the Transactions table)
should avoid any confusion, but nevertheless it would be wise to change it.

Another point is that it looks as though you might be leaving the credit or
debit column Null in each row as a appropriate. Its best to give currency
columns a DefaultValue property of zero, however, in table design and set
their Required property to True (Yes). For one thing Null is semantically
ambiguous, and they also cause problems in calculations as any arithmetical
expression involving a Null evaluates to Null, e.g. 100 + Null = Null.
Similarly in comparison operations, e.g. 100 > Null = Null. Null and zero
are not the same thing; zero is a value, Null is the absence of a value.

Ken Sheridan
Stafford, England
Hi Al
Thank for your reply, but:
I would like to see the balance in every row and there is another little
problem, the starting balance

[TransID] [Date] [Description] [Credit] [Debit] [Balance]
1 09/01/01 start balance 30
30
2 09/01/13 deposit 100
130
3 09/02/14 payment 50
80

How can I see in a report or in a query the balance per every row?

Thank again to everybody


kofmf,
Well, actually... your example has a balance of -80
[quoted text clipped - 23 lines]

--
Message posted via AccessMonster.com


.
 

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