Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Re-read Post #10! You're still using

    =Sum([ExtendedPrice])

    and you cannot do this with an Aggregate Function against a calculated field! You have to use Sum() against the calculation, itself:



    =Sum([Qty]*[UnitPrice])

    Linq ;0)>

  2. #17
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    Maybe more accurate to say cannot reference a textbox. Aggregrate expression can only reference fields in the form RecordSource. If you did the calc in query then that would create a field in the form RecordSource that could be referenced.

    So as Linq describes:

    =Sum([Qty] * [UnitPrice])
    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.

  3. #18
    atuhacek is offline New
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Michigan
    Posts
    61
    First make sure your Qty text box isn't named Qty same with Unit price. If the control and field have the same name it will error.

    Second your order subtotal doesn't need the .Form in it.

  4. #19
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    Error will occur if textbox has same name as bound field and expression in that textbox references the name.
    For instance, field and textbox have same name Qty.
    Expression in that textbox ControlSource: =Nz([Qty],0).
    This is circular reference.
    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.

  5. #20
    atuhacek is offline New
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Michigan
    Posts
    61
    It would be a good idea to get in the habit of renaming your controls. Most programmer use a similar naming convention of using a prefix of the control type with the field name (like txtName to represent a textbok the holds a name field data) doesn't matter what naming convention you use but you should choose one.

    For missinglinq. If you do the calculation in a query and then use the alias from that query you are using a field for your domain aggregate function. Works perfectly well and is easier than typing out the the entire calculation whenever you need it.

    Check your control names and edit out the .Form I mentioned earlier and you should be fine and do the calculation as missinglinq describes or put it in the query.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 05-24-2013, 04:39 PM
  2. Replies: 2
    Last Post: 05-23-2013, 08:29 AM
  3. Replies: 8
    Last Post: 04-29-2013, 12:11 PM
  4. Replies: 9
    Last Post: 03-22-2013, 06:37 AM
  5. Replies: 4
    Last Post: 10-18-2011, 10:18 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