I have a table with two fields that each can have duplicate values but both can't have the same values in other records. The form has the type field as combo box and refNo as combo box and text box.
example of data
tbl_main,
type refNo
small W239
large W239
small W250
large W239 duplicate
small W239 duplicate
I came up with this code but seems like I'm missing some kind of qoutes or something easy. help please....
example of data
tbl_main,
type refNo
small W239
large W239
small W250
large W239 duplicate
small W239 duplicate
I came up with this code but seems like I'm missing some kind of qoutes or something easy. help please....
Private Function IsDuplicateRecord() As Boolean
On Error Resume Next
Dim previousRecordID As Long
IsDuplicateRecord = False
previousRecordID = 0
previousRecordID = DLookup("Dummy", "tbl_main", "type= " & Forms!frm_entry!cbotype&
AND"refNo=" & Forms!frm_entry!cborefNo OR Forms!frm_entry!txtrefNo&)
If previousRecordID <> 0 Then
MsgBox "Record Exists Already"
IsDuplicateRecord = True
End If
End Function