Hello All,
I'm working on a query in access 2003 that will check (records within the same table) to see if records are duplicated. Do I need to sort the table? If so I would sort it by FROM_ID, TO_ID, TRAN, PO#, INVOICE#, CTRL#.
Here is an example of duplicate and non duplicate records.
The logic is based on checking 6 fields. If FROM_ID, TO_ID, TRAN, PO#, INVOICE# are the same and CTRL# from row above is less than CTRL# from row below Duplicate value is Yes, else No. I know how to write it in excel but access is not my forte.
In Excel the formula would go in the Duplicate column:
IF(AND(A3=A4,B3=B4,C3=C4,D3=D4,E3=E4,F3<F4),"Yes","No")
I thought about doing a nested if but it doesn't seem applicable, same with case statement.
Any ideas or suggestions are greatly appreciated.
-Chris
I'm working on a query in access 2003 that will check (records within the same table) to see if records are duplicated. Do I need to sort the table? If so I would sort it by FROM_ID, TO_ID, TRAN, PO#, INVOICE#, CTRL#.
Here is an example of duplicate and non duplicate records.
Code:
FROM_ID TO_ID TRAN PO# INVOICE# CTRL# Duplicate
1129472024 3133692222 IN 278777 466658 2155 Yes
1129472024 3133692222 IN 278777 466658 2156 No
2128582572 3143640039 IN 280908 466780 3050 No
3567426528 7463004869 IN 153279 108059 2034 No
In Excel the formula would go in the Duplicate column:
IF(AND(A3=A4,B3=B4,C3=C4,D3=D4,E3=E4,F3<F4),"Yes","No")
I thought about doing a nested if but it doesn't seem applicable, same with case statement.
Any ideas or suggestions are greatly appreciated.
-Chris