Hey guys! How are things?
Well I am having a little problem with this code for duplicate entries
What it supposed to do is when a permit no that is already in the database is entered, it will display a message saying so and then take you to that record itself
Here is how my code looks
However I keep getting an error saying there is a data type mismatch
permitno is a long integer
Also it is in the before update event procedure
Any help would be much appreciated
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.permitno.Value
stLinkCriteria = "[permitno]=" & "'" & SID & "'"
'Check PERSON table for duplicate Permit Ids
If DCount("permitno", "Person", stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Permit Number " _
& SID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", vbInformation _
, "Duplicate Information"
'Go to record of original Permit Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Thanx
RUPELO
Well I am having a little problem with this code for duplicate entries
What it supposed to do is when a permit no that is already in the database is entered, it will display a message saying so and then take you to that record itself
Here is how my code looks
However I keep getting an error saying there is a data type mismatch
permitno is a long integer
Also it is in the before update event procedure
Any help would be much appreciated
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.permitno.Value
stLinkCriteria = "[permitno]=" & "'" & SID & "'"
'Check PERSON table for duplicate Permit Ids
If DCount("permitno", "Person", stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Permit Number " _
& SID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", vbInformation _
, "Duplicate Information"
'Go to record of original Permit Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Thanx
RUPELO