I am using the following code to check if the invoice being entered already exists within the db. I get the "compile error: User-defined type not defined" What is the solution to this eorror? Thanks in advance for your help!
Code:
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.Invoice_No.Value
stLinkCriteria = "[Invoice_No]=" & "'" & SID & "'"
'Check StudentDetails table for duplicate StudentNumber
If DCount("Invoice_No", "tbl_FuelUsage", _
stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Invoice Number" _
& SID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", _
vbInformation, "Duplicate Information"
'Go to record of original Inovice Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub