Results 1 to 2 of 2
  1. #1
    Andy camp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    5

    Update table with inner select

    Hello,

    I'm new to databases and trying to run the below query.

    When I run the query the following message is displayed
    Undefined function SummaryTable.Total in expression

    How to retrieve the value for SummaryTable.Total to use in the update.



    My aim is to retrieve the relevant value for total from the SummaryTable (inner select) to use in the calculation. The text value for CarType, NumberDrivers and NumberClaims from the SummaryTable are together used as the primary key.

    The table profile data doesn't share a link with the summary table. I want to be able to perform the calculation on all records ([ProfileData].CarValueO1 = [ProfileData].CarValue * SummaryTable.Total)

    UPDATE [ProfileData] SET [ProfileData].CarValueO1 = [ProfileData].CarValue * SummaryTable.Total
    (SELECT SummaryTable.Total
    FROM SummaryTable
    WHERE ((SummaryTable.CarType ="Sedan") AND (SummaryTable.NumberDrivers="NumberDrivers1") AND (SummaryTable.NumberClaims="NumberClaims1")));

    SummaryTable structure:

    CarType Text
    NumberDrivers Text
    NumberClaims Text
    Total Number

    Thanks for your help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Why are you saving aggregate data? This is usually a bad idea. Aggregate data can be calculated when needed.

    If you want the total of all records in SummaryTable, must do an aggregate (Group By) query or use DSum() domain aggregate function.
    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. Replies: 7
    Last Post: 11-24-2014, 02:11 PM
  2. update table from select
    By cthorn112 in forum Queries
    Replies: 3
    Last Post: 06-27-2012, 09:01 AM
  3. Replies: 1
    Last Post: 08-30-2011, 07:35 AM
  4. Replies: 29
    Last Post: 04-18-2011, 07:09 AM
  5. Multi-select listbox and update flag in table
    By Suresh in forum Programming
    Replies: 0
    Last Post: 12-19-2007, 01:04 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