473,468 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Debit, Credit & Balance calculation in MS Access

4 New Member
Dears,
I have one query in MS Access with date, debit & Credit fields as showing below.

Date Debit Credit
01-08-2010 0 1000
02-08-2010 500 0
03-08-2010 0 2000
04-08-2010 1500 0

Kindly help me anyone to find below three things.
1. How can we get the balance as per debit & Credit rules as given below?

Date Debit Credit Balance
01-08-2010 0 1000 1000
02-08-2010 500 0 500
03-08-2010 0 2000 2500
04-08-2010 1500 0 1000

2. How can we get the opening balance?
3. How can we show debit, Credit & Balance within selected dates together with opening balance in a Form or Report ?
Aug 31 '10 #1
3 16274
beacon
579 Contributor
Hi Zalfa,

For #1, here's a link that talks about running totals, which you can use for your balances: http://articles.techrepublic.com.com...1-6140569.html.

You will likely need a form to select a specific person and then have the ID associated with that person passed to a query to filter the records when the form you're using to display the balances opens.

So, two forms, one to select the person you want to view the balances for and another to display the balances. The first form passes the ID for the person into the query and calls the second form, which opens with the records filtered for the person selected.

For help on using a form to pass custom parameters, view this link: http://www.fontstuff.com/access/acctut08.htm

For #2, in the Load event of the form, use DAO to create a recordset clone and traverse to the first record, then set a textbox on the form equal to the pointer.

Here's an example...it assumes that you have a textbox on your form called txtMyBalance and a field in your query called Balance:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  
  3.     'Make sure you have DAO 3.6 selected in your references
  4.     Dim rst as DAO.RecordSet
  5.     Dim myRecord as Long
  6.  
  7.     Set rst = Me.RecordSetClone
  8.  
  9.     With rst
  10.         .MoveFirst
  11.         myRecord = .RecordCount
  12.     End With
  13.  
  14.     txtMyBalance = = rst![Balance]
  15.  
  16. End Sub
  17.  
For #3, you'll have to do a combination of #1 and #2. You'll need to create a form that accepts date parameters and use this to filter the query that is the record source for your form that displays the balances. If the opening balance may not be included in the date range, you may need to create a separate query that returns all transactions for a person, so that you can grab the opening balance.

Hope this helps...

beacon
Sep 1 '10 #2
Zalfa Arif
4 New Member
Dear Beacon,
For #1: As per your instruction I have successed in finding balance of Credit&debit in query. But still there is problem when I'm filtering. I have another filed also in this query which is called as 'Account Type'. The filed 'Balance' is calculating hidden records also when I'll filter 'Account Type' filed
Sep 2 '10 #3
beacon
579 Contributor
This may or may not be true, but I think you will likely need a separate query for each 'Account Type' or you will need to make the query parameter-based as the records will have to be filtered by the account type prior to compiling the records.

If your goal is to ultimately output the data to a form, the parameter idea (that I provided as a link in my first post) would be ideal.
Sep 3 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Pres | last post by:
I am not an experienced programmer. I do have a question regarding workday calculations. I have 3 fields. CURDATE, NUMDAYS, CALCDATE After entering the first two fields, normally the current...
2
by: DLN | last post by:
I'm using a standalone Access database to record customer payments and we have a separate credit card authentication box. Is there any easy to implement software that will integrate into access to...
7
by: gj | last post by:
I have an application in Access 97 I will be rewriting in the latest version of Access in 6 months. In the meantime, does anyone know of an ActiveX control I can add into an Access 97 form to...
1
by: jdph40 | last post by:
I am trying to enter text to look like paragraphs in a text box on a report, making it look like a memo. I enter (Chr$(13) & Chr$(10) & Chr$(10)) to insert a carriage return and 2 line breaks, but...
5
by: jqpdev | last post by:
Hello all... I'm coming from a Borland Delphi background. Delphi has a specific component called a Data Module. In the designer the Data Module behaves like a windows form. A developer can...
13
by: Maria Mela | last post by:
Hello everyone... Anybody can help me on this question, please? i´ve this code in my application: /*for Card creation*/ typedef struct card { etc,etc } Card; typedef Card *PtrCrt;
1
by: tam76131 | last post by:
Hello, I'm very new to access and have been struggling with the subtotal function in access. I have a very large table with the following info State City ID Month ...
1
by: Dan1 | last post by:
Hi Guys, I have borrowed below VB code which I like to use to validate card numbers in ms access 2003 Database text box"CardNumber" The card will be checked as the user clicks a command buttom and...
1
by: saxena09 | last post by:
Hi All, m Himanshu Saxena from new delhi i want to overwrite the value in text box as:- DATE PartyId Dr Cr 01/04/08 ABC 500.00 0.00...
3
by: emannasser | last post by:
i need ho know how o calculate or how to get the blance debit credit = balnce 100 20 = ? it dosent show the balnce in the form .....
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.