Re: Form problem
- From: "Dirk Goldgar" <dg@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 3 Jul 2005 18:14:08 -0400
"tope12" <tope12@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:63F2C7F6-C915-4DB5-88A4-D236304DB7CB@xxxxxxxxxxxxx
> the realtionship between the department table and budget tables is a
> 1:M relationship. They're connected by the employee_department
> attribute (PK in department, FK in budget). Department is connected
> to the meeting table through the employee table. The Department and
> Employee table is a 1:M connection through the employee_department
> field. The employee and meeting tables is a 1:M relationship.
> They're connected by the employee_code attribute (PK in employee, FK
> in Meeting).
Thanks, that helps. I'm not sure I've figure out exactly what you're
after, so check if these assumptions are correct:
1. Your form is supposed to be based on the table Budget, or on an
updatable query of that table.
2. The form should show the record/all records for a specific
department, to be specified by a prompt when the user opens the form.
3. You want to show on that form the sum of Meeting.meeting_actcost for
every employee in that department.
If these assumptions are correct, I think I might handle it as follows:
1. Create a new query named "qryDeptMeetingCost" with SQL like this:
SELECT
employee_department As Dept,
Sum(meeting_actcost) As budused
FROM Employee INNER JOIN Meeting
ON Employee.employee_code = Meeting.employee_code
GROUP BY employee_department;
2. Let your form be based on a recordsource query like this:
SELECT
employee_department
ibud,
cbud,
DLookup("budused", "qryDeptMeetingCost",
"Dept='" & [employee_department] & "'")
FROM Budget
WHERE employee_department = [Enter Branch];
Note: that assumes that the department field is a text field, which it
may not be. If it's a number field, then the criterion for the DLookup
expression should be
"Dept=" & [employee_department])
I have hope that something along those lines is what you're looking for.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.
- Follow-Ups:
- Re: Form problem
- From: tope12
- Re: Form problem
- References:
- Re: Form problem
- From: tope12
- Re: Form problem
- Prev by Date: getting back to a record
- Next by Date: Cannot find a record after an insert statement
- Previous by thread: Re: Form problem
- Next by thread: Re: Form problem
- Index(es):
Relevant Pages
|