Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

total a table to a field in another table

Status
Not open for further replies.

not2bright

Technical User
Dec 20, 2007
1
NZ
I'm rather new to access so any help will be greatly appreciated.

I have 1 table [EXPENSES] which lists all expenses for all people

john $12
pete $6
al $4
john $11
john $3

I have another table [PEOPLE] and I want their totals stored there

al $4
john $26
pete $6

How do I go about this?
 
This is actually pretty simple to do, although I'm not sure how much you know about Access. You were right in creating 2 tables. I would create an tblEmployee table, with an EmployeeID field with autonumber data type, EmpLastName with text data type and EmpFirstName as text data type. I would create a primary key on the EmployeeID field. The second table I would call tblExpenses. In this table I would have at least 3 fields, ExpenseID, which might be a purchase order number, EmployeeID as text data type and Expense as a currency data type. Then I would would click on the relationships icon, add both tables, and click the mouse on the tblEmployee.EmployeeID field and drag it to the tblExpense.Employee field and declare a one to many relationship. Then I would create a form, first adding all the fields in the tblEmployee and then all the fields in tblExpense. After you create the form/subform, add a text control to the tblExpense subform on the form footer and enter this formula in the text box: =Sum([Expense]). I tried it and it works. I hope I didn't confuse you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top