Results 1 to 5 of 5
  1. #1
    rbraitz is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2020
    Posts
    3

    Update Query - Making sure this is correct


    I am trying to write an update query and not having much luck. I have a 'history' table of transactions produced by Quickbooks that was imported into excel/and then access. Let's call this transactions_main (in this table, I have 2 columns that I would like to value based upon the values in a separate table, called banktrans. In the banktrans table, I have a cleared date, checknum, and a cleareddate. I want to update the values from banktrans into the transactions_main and only populate the data in the columns cleareddate and clearedamount. The filed that would link them in theory is checknum. when i run the update query, it deletes the data in the banktrans table which I'm not understanding why. Thank you in advance.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Why have data in both tables and not just retrieve in query joining records?

    Provide your query SQL statement. Sample tables might be helpful. If you want to provide db for analysis, follow instructions at bottom of my post.
    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. #3
    rbraitz is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2020
    Posts
    3
    1. Thank you for your reply.
    2. I want to keep them separate because I will write a Macro to import them into the banktrans table on a daily basis.
    3. I will have automated reports via a Macro.
    4. my SQL is all messed up since I've been messing with it, sorry.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You were missing JOIN clause and field references wrong

    UPDATE transaction_main INNER JOIN banktrans ON transaction_main.checknum = banktrans.checknum SET transaction_main.cleareddate = [banktrans].[cleareddate], transaction_main.clearedamount = [banktrans].[amount];

    Still don't understand why need to duplicate data. Yes, import data daily - can still build a query joining tables to retrieve data. That is what is required for the update action anyway. Is there something else I should know about process?
    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. #5
    rbraitz is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2020
    Posts
    3
    MANY MANY Thanks!!!!! it works.....!!! wahoo...

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

Similar Threads

  1. Replies: 2
    Last Post: 10-17-2017, 12:00 PM
  2. Replies: 5
    Last Post: 09-12-2014, 06:41 AM
  3. Replies: 5
    Last Post: 03-05-2014, 09:59 AM
  4. Replies: 9
    Last Post: 06-26-2011, 09:14 PM
  5. making into update query
    By tom4038 in forum Queries
    Replies: 1
    Last Post: 09-23-2009, 11:19 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