Access 2010 report with a calculated field

Posted on 2012-04-06
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?
Question by:peispud
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 77

Accepted Solution

peter57r earned 500 total points
ID: 37816746
Just add a text box and set the controlsource to:

Author Comment

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
LVL 77

Expert Comment

ID: 37817073
Try doing what I posted above
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

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
LVL 77

Expert Comment

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

Author Closing Comment

ID: 37819773
You were right!

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


Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

691 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