querry 2 tables

D

dj2719

I have a table which I input labor charges(laborID). I have a second table
which I input parts charges(partsID). when I querry the 2 table to create my
billing information I get duplicated results. If I have 1 labor charge and
multiple parts charges the labor charges or duplicated as if to keep the rows
equal.
EXAMPLE of what i expect to see:
workorderID laborID partsID
1 1 1
1 2
1 3
What I actually see is the laborID duplicated for for partsID 2 & 3
This seems so easy but I just cant get it to work!
 
K

KenSheridan via AccessMonster.com

You can't do that directly in the query (not strictly true as it could be
done with a UNION query, but its not a good way to go). It should be done in
a report, in effect an Invoice, based on the query. You can then group the
report by the work order and give it a group header and/or footer. The
labour charge can then be included in the header or footer to show only once,
while the parts charges can be included in the detail section. In the group
footer you can total the parts charges in an unbound text box with a
ControlSource such as:

=Sum([PartsCharge])

and also give the total of labour and parts charges in another unbound text
box with a ControlSource such as:

=Sum([PartsCharge])+[LaborCharge]

Note that the position of the parentheses around only the [PartsCharge] is
important in the latter case.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top