Results 1 to 8 of 8
  1. #1
    Nikki Harry is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2018
    Location
    Manila
    Posts
    13

    Text box to show the SUM of [Net], which is a calculated field based on [Sold]*[Product_Price].

    Hi all,

    Background:



    2 linked tables [02Transactions] and [03Products].

    1 continuous form [TransactionBase] which takes data from both tables.

    3 text boxes (of interest) on the form:
    [Sold] - created with the form, the value of which is specified by the form's text box control source [Sold].
    [Text25] (To be renamed 'Product_Price') - an added calculated text box, the value of which is derived by a DLookUp statement that gets the relevant value for each record from the table [03Products].
    [Text28] (which will be renamed to 'Net') - an added calculated text box that contains =[Text25]*[Sold] in the control source .

    Everything to this point works as it should.

    The Problem:

    I created a text box [Text36] (To be renamed 'Total Net') and placed it in the form footer. Despite my best efforts in following the examples, including the obvious =SUM([Text28]), nothing I have placed in the control source has returned anything else but #Error.

    Is it just that Sum doesn't like operating on calculated fields?

    The Solution:

    This is where you good folks get to throw your ideas at me

    Thanks all

    NH

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2016
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538

  3. #3
    Nikki Harry is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2018
    Location
    Manila
    Posts
    13
    Thanks for the effort Alan. Unfortunately I still get the #Error msg in the text box. Something Access doesn't like about Sum(ing) a calculated form based text box, especially when one of the fields used to arrive at the calculated text box value gets its value from DLookUp statement to another table. ho hum.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Something Access doesn't like about Sum(ing) a calculated form based text box, especially when one of the fields used to arrive at the calculated text box value gets its value from DLookUp statement to another table. ho hum.
    Perhaps try using the DLookup() expression in the Sum() function rather than referring to a control that's using DLookup().
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Move the calculations to the forms underlying query - then things will get much easier, as you can then use the Sum Functions on your form.

    You can't normally sum a calculated form field.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    Nikki Harry is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2018
    Location
    Manila
    Posts
    13
    Problem Solved! Thanks Minty, I was a few steps behind you.
    Created a query that got rid of all the trying to grab data from different tables. After that a simple =Sum([Sold]*[Price]) worked like a dream.

    Alan, Bob, thanks for the input.

    Question: Who marks these things SOLVED? I do it, or an adult?

  7. #7
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Glad that sorted it. As a general rule of thumb anything like that is not only easier to work with in the query, but faster to run as well.

    Solved - You can - or ask a responsible adult
    At the top of the forum is a button "Mark Thread as Solved" Press that!
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Any poster in a thread can flag 'solved' - done.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Date calculated based on text field
    By arbucklemw in forum Queries
    Replies: 7
    Last Post: 06-15-2017, 02:54 PM
  2. Replies: 1
    Last Post: 05-22-2017, 05:59 AM
  3. Need to show units that haven't been sold yet
    By Thomasso in forum Queries
    Replies: 7
    Last Post: 02-19-2017, 02:25 PM
  4. Replies: 1
    Last Post: 03-27-2014, 06:42 AM
  5. Show how many times an item is sold?
    By xtrareal22 in forum Forms
    Replies: 4
    Last Post: 11-29-2013, 08:33 AM

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