Results 1 to 3 of 3
  1. #1
    rjobaan is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2018
    Posts
    2

    compare two tables and make changes

    I do not know if you can do this with a query or macro. But let me first start to explain what I want to do
    how can i do the following:

    i have two tables
    Table A

    Member EventDate Distance Time PR
    Joe 1-1-2017 100 250 --
    Joe 3-2-2017 200 500 --
    Joe 4-4-2017 100 200 --
    Joe 6-4-2017 100 210 --
    Joe 12-5-2107 200 490 --

    Table B

    Member Distance Time PR EvenDate
    Joe 100 9999 P0 31-12-9999
    Joe 200 9999 P0 31-12-9999

    Table A has all event results of Joe
    table B has initial only all distance Joe can compete and time 9999
    Now i want to do the following
    I want to check every row of table A with B and insert new record in table B if new personal best
    So first row
    Table B should be updated as follows: because his 100 is faster then his current time 9999 a new record should be inserted

    Table B

    Member Distance Time PR EvenDate
    Joe 100 9999 P0 31-12-9999
    Joe 200 9999 P0 31-12-9999
    Joe 100 250 P1 1-1-2017




    Table A should also be updated, because he beat his personal best, so first event Pr --- change to PR

    Member EventDate Distance Time PR
    Joe 1-1-2017 100 250 PR
    Joe 3-2-2017 200 500 --
    Joe 4-4-2017 100 200 --
    Joe 6-4-2017 100 210 --
    Joe 12-5-2107 200 490 --

    Second row
    Table B should be updated as follows, because his 200 is faster then his current time 9999 a new record should be inserted


    Member Distance Time PR EvenDate
    Joe 100 9999 P0 31-12-9999
    Joe 200 9999 P0 31-12-9999
    Joe 100 250 P1 1-1-2017
    Joe 200 500 P1 3-2-2017

    Table A should also be updated, because he beat his personal best, so second event Pr --- change to PR

    Member EventDate Distance Time PR
    Joe 1-1-2017 100 250 PR
    Joe 3-2-2017 200 500 PR
    Joe 4-4-2017 100 200 --
    Joe 6-4-2017 100 210 --
    Joe 12-5-2107 200 490 --

    Third row
    Table B should be updated as follows because his 100 is faster then his current fastest time 250 a new record should be inserted

    Member Distance Time PR EvenDate
    Joe 100 9999 P0 31-12-9999
    Joe 200 9999 P0 31-12-9999
    Joe 100 250 P1 1-1-2017
    Joe 200 500 P1 3-2-2017
    Joe 100 200 P2 4-4-2017

    Table A should also be updated, because he beat his personal best, so second event Pr --- change to PR

    Member EventDate Distance Time PR
    Joe 1-1-2017 100 250 PR
    Joe 3-2-2017 200 500 PR
    Joe 4-4-2017 100 200 PR
    Joe 6-4-2017 100 210 --
    Joe 12-5-2107 200 490 --

    Fourth row
    Table B should be not be updated because his 100 is slower then his current fastest time 200

    Member Distance Time PR EvenDate
    Joe 100 9999 P0 31-12-9999
    Joe 200 9999 P0 31-12-9999
    Joe 100 250 P1 1-1-2017
    Joe 200 500 P1 3-2-2017
    Joe 100 200 P2 4-4-2017


    Table A should also not be updated, because no personal record

    Member EventDate Distance Time PR
    Joe 1-1-2017 100 250 PR
    Joe 3-2-2017 200 500 PR
    Joe 4-4-2017 100 200 PR
    Joe 6-4-2017 100 210 --
    Joe 12-5-2107 200 490 --

    Fifth row
    Table B should be updated as follows, because his 200 is faster then his current time 500 a new record should be inserted

    Member Distance Time PR EvenDate
    Joe 100 9999 P0 31-12-9999
    Joe 200 9999 P0 31-12-9999
    Joe 100 250 P1 1-1-2017
    Joe 200 500 P1 3-2-2017
    Joe 100 200 P2 4-4-2017
    Joe 200 490 P2 12-5-2017

    Table A should also be updated, because he beat his personal best, so second event Pr --- change to PR

    Member EventDate Distance Time PR
    Joe 1-1-2017 100 250 PR
    Joe 3-2-2017 200 500 PR
    Joe 4-4-2017 100 200 PR
    Joe 6-4-2017 100 210 --
    Joe 12-5-2107 200 490 PR


    How can i do this?
    Or should do it different to make it easier, by creating new tables or something. But i hope this examples shows what i want to accomplish

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    ALL records would be added ,then the best PR would be marked.

  3. #3
    rjobaan is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2018
    Posts
    2
    What do You mean? Not all records are adres. And the have all different pr marks because i need to says the history of his pr's

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

Similar Threads

  1. need to compare two tables
    By ZeroWard in forum Access
    Replies: 1
    Last Post: 02-01-2016, 10:26 AM
  2. Can't make a query compare and exclude...
    By surgicalstrike in forum Queries
    Replies: 29
    Last Post: 08-18-2015, 06:33 AM
  3. Compare two tables
    By hoachen in forum Queries
    Replies: 2
    Last Post: 08-11-2015, 06:09 PM
  4. Compare tables and tell me differences
    By cowboy in forum Programming
    Replies: 2
    Last Post: 08-11-2010, 08:32 AM
  5. Compare two tables
    By Igli in forum Access
    Replies: 2
    Last Post: 07-05-2010, 10:30 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