Consulting

Results 1 to 5 of 5

Thread: help with Multiple criteria for table update

  1. #1
    VBAX Mentor
    Joined
    Aug 2012
    Posts
    367
    Location

    Question help with Multiple criteria for table update

    Hi all,
    I'm sure this is a newbie question - my apologies in advance. I've searched around, but don't understand how to get this to work.
    I can follow SQL and VBA, and am a rank beginner at Access

    I wish to create a system for importing a table from excel and updating a master database with new/modified records from the imported table.
    the records in each table can be matched using [Name] and [dDate] fields (this combo is unique)

    I have a table (tbl_FromExcel) with my imported data. I wish to overwrite/update all data fields (assume fF1, fF2, fF3, and fF4 for this example) where records in the master database (WeeklyKPIs) differ and to create those that don't exist.

    Is there a simple SQL based query command to do this?
    Thanks
    Werafa
    Remember: it is the second mouse that gets the cheese.....

  2. #2
    VBAX Expert
    Joined
    Oct 2012
    Posts
    726
    Location
    No simple command. Sorry. You need several queries to do the deletes, updates and appends.

  3. #3
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    As Jonh says, it can't be done with one query.
    It is possible with 2 queries providing you do not need to delete any records.
    You need one Update query to update all the records in the Master table that match the imported table, if the data is the same it doesn't matter if it gets rewritten..
    You need one Append query to append any records not already in the Master table.

  4. #4
    VBAX Mentor
    Joined
    Aug 2012
    Posts
    367
    Location
    Thanks for that.

    I think I have something like this working now - using the two query approach.
    no delete is needed, and the idea is that even if the excel dataset is reset each fin year (it gets a bit big), the access database retains the history for reporting and analysis.

    I'll post something once I've confirmed that it does work correctly.
    Remember: it is the second mouse that gets the cheese.....

  5. #5
    VBAX Mentor
    Joined
    Aug 2012
    Posts
    367
    Location
    yes - it works
    Thanks all
    Remember: it is the second mouse that gets the cheese.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •