Solved

Access 2010 report with a calculated field

Posted on 2012-04-06
6
448 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
Comment Utility
Just add a text box and set the controlsource to:
=Quantity*Price
0
 

Author Comment

by:peispud
Comment Utility
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
Comment Utility
Try doing what I posted above
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:peispud
Comment Utility
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
Comment Utility
I didn't mention any code.
Just set the controlsource directly  (and don't use 'me.')
0
 

Author Closing Comment

by:peispud
Comment Utility
You were right!

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

Thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now