Hmmm
Well this forum is called
Microsoft: Access Forms Forum
There is another one called
Microsoft: Access Reports at
I understand you need a problem resolved, but I had assumed you were working on a form issue based on where you posted your problem. That being said, lets move on...
The idea of creating a report and form are much the same, except the with a form, the end user can interact, and the developer has a bit more control.
Create your report using the report wizard. Hint, if your report and form use more than one table, you can create a query using query builder and base your report or form on the query instead of using a table.
After completing the rough report, open it up in design mode. You will need to add your unbound text fields using the field names to the detail section of the report.
Based on your information, I do not now the specific names of your fields, or your table design. So I will have to make some assumptions.
- Field names on the report are referenced with the open and close square brackets []
- Field names are: [MaterialCharge], [LaborCharge], [MaterialCost] and [LaborCost]
- In the detail section, you already know how to print these fields on your report.
I am going to call your three calculated fields
[TotalCharge]
[TotalCost]
[ProfitMargin]
When you place a new text field on the report, Access will automatically name the field [Textnnn] where nnn is a sequential number. Example: Text116. You can change the name of the text object by using the property window. To open the property window, right click anywhere on the report and select the "properties". Then navigate to the "Other" tab and change the default [Textnnnn] name to a more meaningful name. This extra step does not have to be done, but it sure adds "readability" to your code when you or some one else edits your report or form later on.
Add three text boxes to the detail section of the report. Select the first text box, and then focus on the property window.
Navigate back to the data tab on the property window.
For the "Control Source", for the [TotalCharge] enter...
= [MaterialCharge]+[LaborCharge]
The formula names used for the control source MUST match the actual field names.
Now select the second text box and focus on the property window.
For [TotalCost], the "Control Source" should be
= [MaterialCost]+[LaborCost]
Now select the third text box and focus on the property window.
For [ProfitMargin], the "Control Source" should be
= ([TotalCharge] - [TotalCost])/[TotalCost]
Access, when it "prints" your report, actually processes it twice (or more). On the first pass, adjust for formatting, "level breaks", cululative values, etc, and it will calcuate the values for your new text fields that you just created.
Later, on the subsequent pass, it prints the actual values. Based on what you have provided, and my assumptions, it should work.
Richard