I have to fields refNo (String) and Volume (Integer) and would like to check if the combination of these 2 fields are already inputted in a table, before I actually save them. If they are already there I don't want to duplicate the record.
This is giving me a type mismatch. Any ideas why?
Code:
If IsNull(DLookup(("[NotaryRefNo]" And [Volume]), "[tblNotaryIndex]", ("[NotaryRefNo]='" & refNo & "'" And "[Volume] = " & Volume & ""))) Then MsgBox "Record exists"
End If
sql = "INSERT INTO tblNotaryIndex([NotaryRefNo], [Volume], [Date Start], [Date End], [Condition], [Publication], [Publication Link], [ShelfId]) " & _
"VALUES('" & refNo & "'," & Volume & ",#" & dateStart & "#,#" & dateEnd & "#, '" & condition & "', '" & publication & "','" & filePath & "','" & shelf & "')"