The following codes works when Lines 2 and 3 are strings but when I change them to doubles it does not work. I believe my error lies in line 9 but I need help in fixing it.
Thanks
Dan
Thanks
Dan
Code:
Private Sub SPBI_BeforeUpdate(Cancel As Integer) Dim SID As Double Dim stLinkCriteria As Double Dim rsc As DAO.Recordset Set rsc = Me.RecordsetClone SID = Me![SPBI] stLinkCriteria = "[SPBI]=" & "'" & SID & "'" 'Check tblSexOffenders table for duplicate SPBI Number If DCount("SPBI", "tblSexOffenders", _ stLinkCriteria) > 0 Then 'Undo duplicate entry Me.Undo 'Message box warning of duplication MsgBox "Warning SPBI Number " _ & SID & " has already been used." _ & vbCr & vbCr & "You will now been taken to the record.", _ vbInformation, "Duplicate Information" 'Go to record of original Employee ID Number rsc.FindFirst stLinkCriteria Me.Bookmark = rsc.Bookmark End If Set rsc = Nothing End Sub
Comment