Results 1 to 3 of 3
  1. #1
    Michael_Red is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    May 2016
    Posts
    6

    Query to update finical amounts but return all data?


    Hi
    I have a query that reports on 3990 records. The report runs fine, however it has come to light that we have to make 50 adjustments to the finical fields where the wrong amounts are shown the the database. We cannot update the database unfortunately so I'm attempting to adjust the data in the query. I have a table that has the client ref and then shows what adjustment is to be made, so for example client ref 12345 has an adjustment of -200.
    So I link my query to the table of adjustments, have a join that returns all data from the query. I then have a field that add the amount form the query and then the adjustment, so the amount shown is correct. This works however the field only shows the adjustment not all the amounts. I believe this is because the records that are not present in the adjustment table cant find a matching record and just returning blank. Is there a way around this at all? Is there a better way within the query to make adjustments to data? I have looked as using an update query, the problem with that is the amounts could change, the adjustment is always the same.

    Thanks
    Michael

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    use a left join between your original query and your adjustment table - this will show all the records in your original query plus the adjustment table when a record exists.

    With regards your adjustment, if it is a replacement figure the use

    Corrected:nz(tblAdjustment.adjvalue,qryOriginal.or igValue)

    if it is an adjustement to derive a new figure use

    Corrected:qryOriginal.origValue+nz(tblAdjustment.a djvalue,0)

    change all names to suit your real table and field names

  3. #3
    Michael_Red is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    May 2016
    Posts
    6
    Hi
    Thank you, worked as expected, thanks very much. I used the correct option.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-02-2015, 07:58 PM
  2. How to Get Data to Override Higher Amounts
    By ns8069 in forum Database Design
    Replies: 1
    Last Post: 01-28-2015, 02:46 PM
  3. Need different amounts of data depending on a user input?
    By parkerjallen in forum Database Design
    Replies: 2
    Last Post: 11-13-2012, 03:17 PM
  4. Query doesn't return all data
    By hawzmolly in forum Queries
    Replies: 6
    Last Post: 03-26-2010, 09:12 AM
  5. Return records not updated by update query
    By ars80 in forum Queries
    Replies: 2
    Last Post: 05-01-2006, 09:23 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