How to flag duplicates in a new column in ACCESS

lighthaus

New member
Local time
Today, 15:59
Joined
Jan 10, 2012
Messages
1
Hello Experts,
Could you please advise, i would help with code on how to flag duplicates. For example in a table like this

ID---Name---Product ---Duplicate
QX1 name1 pd1 1
QX2 name2 pd1 1
QX2 name3 pd1 2
QX2 name4 pd1 3
QX2 name5 pd1 4
QX3 Name6 pd3 1
QX4 name7 PD1 1

At the moment I have written VB code as follows:
Public Function Find_Duplicates(DWH_Transaction_ID As String) As Integer
Dim Counter As Integer

Counter = DCount(" [DWH Transaction ID] ", "[PJ EHT Transactions for week Temp]", " [DWH Transaction ID] = " & Chr(34) & DWH_Transaction_ID & Chr(34))

Find_Duplicates = Counter

End Function

The code above gives me the maximum counter for each duplicate ie in my table above ID QX2 in the duplicate filed is flagged as 4 in all rows. I would like it as shown above. I really dont care which record is marked as 1, 2, etc

Can you please help? How do I modify the code?
 
Does it have to be 1, 2, 3, 4?

Could it be 11, 45, 101, 1032 ?
 

Users who are viewing this thread

Back
Top Bottom