Consulting

Results 1 to 3 of 3

Thread: Check if a combination of field values exist in table, update if not.

  1. #1
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    3
    Location

    Check if a combination of field values exist in table, update if not.

    Hi Guys, I'm having a little trouble with something.

    I want to see if a combination of fields, say columns C+D, already exist as a combination in Columns A+B anywhere in the table (not just the same record.) If they do not, then I want to move the values from C&D over to A&B, if they do I would want to delete that record.

    This is part of a data import and transformation module for tables that sit behind Cascade Combo Boxes, so currently the old data is in the A&B Columns and new data is in new records with data only in C&D (Data types do not yet match). I have pulled the unique combinations from the new data set out but some will match existing combinations.

    Origianlly tried SQL EXISTS but this only checks the record, I suspect I need a Do Loop but not sure how to start with this query. Would appreciate any guidence.

    Many Thanks,

  2. #2
    VBAX Regular
    Joined
    Jan 2018
    Location
    The Netherlands
    Posts
    45
    Location
    Perhaps it is better that you show us what you already have, in that way we kan help better

  3. #3
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    As Hightree says sample sample data would help a lot.
    This would be tricky with queries alone as you would need both select and delete queries.
    VBA that loops through the records with a second loop to test the rest would be required, ideally I would add a "delete" chckbox to the table that the loop could update where required and then run a delete query based on the delete checkbox to remove them after all the checks have been done.

Posting Permissions

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