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!

Bound fields and reports 2

Status
Not open for further replies.

Zelandakh

MIS
Mar 12, 1999
12,173
GB
I am trying to get back into Access after years of inactivity and I'm REALLY rusty.<br>
<br>
I have a report bound to a lovely query I wrote that lists date, registration plate, total cost of parts and number of hours of labour.<br>
<br>
What I actually want is date, registration plate, total cost of service.<br>
<br>
Service cost = total cost of parts + hours of labour * cost of labour.<br>
<br>
The query brings in total cost of parts and hours of labour. Cost of labour is stored in tblcode.ivalue where tblcode.strcode=&quot;labour&quot;.<br>
<br>
How do I get my labour cost into the report so I can calculate the total bill?
 
Here’s a simple if not elegant solution:<br>
For example purposes I’ll call you main table tblMain.<br>
<br>
Create a query :<br>
SELECT tblMain.Reg, tblMain.Hours, &quot;Labour&quot; AS labourCodeFROM tblMain;<br>
Save query e.g. qryMain<br>
<br>
Now base your report on a query based on qryMain linked to tblcode and calc labour cost:SELECT qryMain.Reg, qryMain.Hours, [hours]*[ ivalue] AS labcostFROM qryMain INNER JOIN tblcode ON qryMain.labourCode = tblcode.code;<br>
<br>
I hope this points you in the right direction.<br>
<br>
There are better, more elegant ways of achieving this ( e.g. use of a function to return the labour value ) .<br>
<br>
<br>
WP <p>Bill Paton<br><a href=mailto:wpaton@neptune400.co.uk>wpaton@neptune400.co.uk</a><br><a href=
 
Thanks Bill. As you say, there are undoubtedly other ways to do it, but it works and now my database is finished.<br>
<br>
You saved me a lot of head scratching.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top