Results 1 to 6 of 6
  1. #1
    davesexcel's Avatar
    davesexcel is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2013
    Location
    Cochrane,AB
    Posts
    4

    Tbl1 field * tbl2 field calculation

    Hi,


    Very first post here.

    I am starting a very simple web DB to start with Access 2010

    TblProduct has Price TblSales has TotalPrice and is equal to TblProduct.price * TblSales.Qty

    Click image for larger version. 

Name:	TblProducts.jpg 
Views:	35 
Size:	58.2 KB 
ID:	12905
    I tried the expression builder and got a message about not being able to use a different table. The relationship icon is not available.

    What would be the best way to get this calculation?

    Thanks.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    do not store calculated values in your tables, it's a huge mistake and shouldn't even be allowed.

    Any time you record a sale store the quantity and price (assuming that prices can change over time you want to capture the price of an item at the time of sale) then perform your total price calculation in a query, or report.

  3. #3
    davesexcel's Avatar
    davesexcel is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2013
    Location
    Cochrane,AB
    Posts
    4
    Thank you, I see what you mean.

    So In a form, how would I get the TotalPrice textbox filled ?
    I click the Qty textbox and select events then After Update.
    How do I enter
    [TotalPrice]=[Qty]*[tblProducts!].[Price]

    Thanks

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Make sure the text box (control in Access Speak) that will hold the total price is unbound. With your form open in design view. Right click on the control. Select Properties and then the data tab. In the control source line type =[tblSale].[Qty]*[tblProducts].[Price]

    alan

  5. #5
    davesexcel's Avatar
    davesexcel is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2013
    Location
    Cochrane,AB
    Posts
    4
    Thanks,
    Getting closer, I am now getting "Name?" error. I suppose the formula doesn't know what price to pick?

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    if your form is bound to your table you shouldn't need the table qualifiers if you are storing the item price at the time of purchase as well as the quantity.

    you'd just need [qty]*[price].

    If your price is still coming from your item list you'd have to set your data entry query to be an autolookup format (your orders table linking to the PK of the items table in a left join)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  2. Replies: 4
    Last Post: 12-02-2011, 06:52 PM
  3. Calculation field
    By johnny in forum Access
    Replies: 4
    Last Post: 08-10-2011, 06:52 AM
  4. Simple field calculation
    By stryder09 in forum Access
    Replies: 4
    Last Post: 02-11-2011, 11:48 AM
  5. Subreport Calculation field
    By Cheshire101 in forum Reports
    Replies: 2
    Last Post: 01-14-2010, 05:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums