Calculating sum of values in a Table Field

Waheed2008

Registered User.
Local time
Today, 21:56
Joined
Jul 17, 2008
Messages
57
This thread is related to my previous one.

I have a table Table1 having 3 fields, ID, Department, Expenses. In a form, I have a ComboBox populated with all Departments and text box of Total Expense. I want that when I select any Department in ComboBox, all the Expenses from Table1, of the selected Department, are sumed-up and show into textExpense.

How it is possible???
Can any budy help me.

Thanks
 
What does the ID identify? The department or the expense?
You need two tables...

Code:
[B]Table Department[/B]
ID
Department

[B]Table Expense[/B]
ID
DepartmentID
Expense

Every kind of thing needs it's own table. Imagine your boss wants to rename his department. In your data you want to do that in one place, not once for every expense.
 
Thanks
MStef has sent the thing which I was looking for. I presented a simple scenario and I shall fit this example into my project accordingly. Thanks again. :)

But lagbolt is very right that there should be two tables. Actualy I have two tables. Almost the same as you have mentioned.

Table Department
ID
Department
etc.

Table Expense
ID
DepartmentID
Expense
Description
etc.

I need the same thing that you mentioned, i.e. I should not change Department name in every expense if it is changed in parent table. It means that some sort of Linking of table is required. But I dont know how to do that in Access. Can you guide me in this regard.

Thanks
 

Users who are viewing this thread

Back
Top Bottom