Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Writing code to move in possible three different tables

I need to write code to be able move one row into a possible three different tables.

I need to check and see if one field from the row in tableNew matches the same specific field in any of the rows in table1.
1)If not, move row to table1.
2)If so, move row to table2.
3)If empty, move row to table3.

In addition, I need to able to write this code as a loop because there are multiple rows in tableNew that need to be evaluated. Thanks.

Comments

  • dokken2dokken2 Member Posts: 532
    : I need to write code to be able move one row into a possible three
    : different tables.
    :
    : I need to check and see if one field from the row in tableNew
    : matches the same specific field in any of the rows in table1.
    : 1)If not, move row to table1.
    : 2)If so, move row to table2.
    : 3)If empty, move row to table3.
    :
    : In addition, I need to able to write this code as a loop because
    : there are multiple rows in tableNew that need to be evaluated.
    : Thanks.


    see uploaded sample module. item 1 & 2 are implemented, don't understand how to move an empty row to table3
  • hawaiistfballhawaiistfball Member Posts: 7
    Sorry for an unclear request. The code needs to be able to check one cell in first row of tableNew with all the cells in a specific field in table1. The idea is to see if that one instances matches anything in the data set in one field.

    1) If the cell is empty(null), move to table3
    2) If the cell finds a match, move to table2
    3) If the cell does not find a match, move to table1

    This need to loop because there are multiple rows in tableNew.

    Hopefully that makes it more clear. Will the code that you wrote work for the new description. Thanks for the help you are a life saver.


  • dokken2dokken2 Member Posts: 532
    see upload file-
  • hawaiistfballhawaiistfball Member Posts: 7
    The code looks great. I will need to use it with my data to make sure that everything works out. Thanks so much for your help.
  • hawaiistfballhawaiistfball Member Posts: 7
    Right now, I am having a problem. If I have two people with the same first name in TableNew, it moves both of them to Table1 when I run the code. And, I need to move the first one to Table1 and the rest to Table2.

    How would I change the code to fix this problem? I am thinking that I will have to load one row at a time.
  • dokken2dokken2 Member Posts: 532

    would need to use some other unique identifier, maybe first+last name, or the primary key
Sign In or Register to comment.