Re: access 2007 accountancy application
- From: "KenSheridan via AccessMonster.com" <u51882@uwe>
- Date: Sun, 15 Nov 2009 16:24:23 GMT
You are probably familiar with creating queries in design view, but when
subqueries are used within a query its not possible to do it all in design
view. What I posted was the SQL of the query. SQL is the language used for
writing queries. When you create query in design view, if you then switch to
SQL view you'll see it as SQL.
So what you need to do is open the query designer and, without adding any
tables, switch to SQL view. Then just copy the SQL:
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;
and paste it into the SQL view window. If all your column (field) names are
as you gave them in your original post the only thing you might have to
change is the table name; I called it Transactions, so for the three times it
says Transactions in the SQL change it to your real table name. If any
column names differ then also change them where necessary. If you want the
results returned in ascending rather than descending date order just change
the last line as I described by taking out the two instances of DESC.
Remember that if a table or column name includes any spaces or other special
characters you must wrap it in square brackets, e.g. [My Table]. If in doubt
wrap the table or field name in the brackets; it won't matter if they aren't
actually necessary.
BTW I don't think your English needs much improvement; it is very good
already.
Ken Sheridan
Stafford, England
kofmf wrote:
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
You can compute the sum of credits to date and the sum of debits to date in[quoted text clipped - 67 lines]
subqueries and subtract the latter from the former to give the balance. As
.
--
Message posted via http://www.accessmonster.com
.
- References:
- access 2007 accountancy application
- From: kofmf
- Re: access 2007 accountancy application
- From: Al Campagna
- Re: access 2007 accountancy application
- From: kofmf
- Re: access 2007 accountancy application
- From: KenSheridan via AccessMonster.com
- Re: access 2007 accountancy application
- From: kofmf
- access 2007 accountancy application
- Prev by Date: Re: Combo Boxes - linking of
- Next by Date: Re: Combo Boxes - linking of
- Previous by thread: Re: access 2007 accountancy application
- Next by thread: Learning VBA
- Index(es):
Relevant Pages
|