I have an interesting problem (well as interesting as coding gets) for which I need some help on. To set the seen, I have a basic form with four fields:
StoreIDCode
WorkDate
LineNumber
Matchkey
When a user enters the first three fields, a match key is created which literally is:
My problem is that once the match key is created I would like to check the rest of the records to see if the match key already exists, i.e identifying duplicate records that have the same storeidcode, workdate and linenumber.
Here is the code I have in place at the moment:
Can I please have some suggestions as to how I can do this. My head is dead right now and Im probably missing something obvious, but hey-ho... thank you!
Simon
StoreIDCode
WorkDate
LineNumber
Matchkey
When a user enters the first three fields, a match key is created which literally is:
Code:
MatchKey = StoreIDCode & WorkDate & LineNumber
My problem is that once the match key is created I would like to check the rest of the records to see if the match key already exists, i.e identifying duplicate records that have the same storeidcode, workdate and linenumber.
Here is the code I have in place at the moment:
Code:
Function DuplicateCheck()
'firstly, check to see that an entry has been put into the three matchkey fields
'StoreIDCode, WorkDate and LineNumber.
If IsNull(Me.StoreIDCode) Then
ElseIf IsNull(Me.WorkDate) Then
ElseIf IsNull(Me.WorkDate) Then
Else
'Assuming all these are there, create a matchkey
MatchKey = StoreIDCode & WorkDate & LineNumber
End If
'once matchkey has been created, see if any other match keys of the same sort exists
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
'WHAT GOES HERE!!!
'if so, delete the record and display message to user saying
'it has been deleted due to duplicate
End Function
Can I please have some suggestions as to how I can do this. My head is dead right now and Im probably missing something obvious, but hey-ho... thank you!
Simon