Solved

Access 2010 report with a calculated field

Posted on 2012-04-06
6
469 Views
Last Modified: 2012-04-07
Microsoft Access 2010

I have a report.   Two of the fields are [Price] and [Quantity]

In the report,  I have added a textbox  whose name is "Total Price"

I would like to have that textbox  contain the value [Quantity] * [Price]  for each record as if it were stored data.

Can this be done?
0
Comment
Question by:peispud
  • 3
  • 3
6 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 37816746
Just add a text box and set the controlsource to:
=Quantity*Price
0
 

Author Comment

by:peispud
ID: 37816946
I tried this


Record_TotalCost.ControlSource = Me.[Quantity] * Me.WholeSale_Price_at_Invoice_Date

I put this code in my  Report_Load event.  When it runs, the code produces an error (see attached pic)

Me.[Quantity] does evaluate to                      2
Me.WholeSale_Price_at_Invoice_Date does  evaluate to          3
error.png
0
 
LVL 77

Expert Comment

by:peter57r
ID: 37817073
Try doing what I posted above
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:peispud
ID: 37817137
I did.   The name of my textbox was Record_TotalCost .  

Therefore,  unless I'm mistaken,  I've done just that.

Record_TotalCost.ControlSource = Me.[Quantity] * Me.WholeSale_Price_at_Invoice_Date
0
 
LVL 77

Expert Comment

by:peter57r
ID: 37817406
I didn't mention any code.
Just set the controlsource directly  (and don't use 'me.')
0
 

Author Closing Comment

by:peispud
ID: 37819773
You were right!

I didn't use the "equal" sign.  That makes all the difference.

Thanks
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Macro to import XML in Access 2013 2 39
Need to Populate a MS Access Table via VBA Code 3 31
User Level Security 6 38
Switch 5 17
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question