Thanks for replying, but I'm afraid I don't understand what bearing that has on what I'm trying to achieve. Can you elaborate please?
By the way, I've discovered another way of achieving the same result:
Code:
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("CategoryTable", dbOpenSnapshot)
rs.FindFirst "Category = """ & Me![Category] & """"
If Not rs.NoMatch Then
Cancel = True
MsgBox "Duplicate!"
End If
The problem is that while this works perfectly for fields where the row source is a value list (as above), I can't get it to work in this case:
Code:
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("LinkTable", dbOpenSnapshot)
rs.FindFirst "DocumentID_LinkFrom = """ & Me![DocumentID_LinkFrom] & """"
If Not rs.NoMatch Then
Cancel = True
MsgBox "Duplicate!"
End If
Here the row source is (for the sake of the example) 'SELECT DocumentID, DocumentName FROM DocumentTable'. The bound column is 1 (a number) and the visible column is 2 (text). What do I need to add? Please help!