I am attempting to use DLookup to retrieve the file number (primary key) of any and all previous records that the hull numbers match in a table named “Vessel”. I have started with the following code, and created a new record with duplicate hull number to test with.
Private Sub Hull_Number_AfterUpdate()
Dim temp As Variant
temp = DLookup("[File_Number]", "[Vessel]", "[Hull_Number] = Forms![Hull_Number]")
MsgBox temp
End Sub
However, the result is always null even though the duplicate record exists in the table.
Having only a basic knowledge of Access, I need a little help in understanding the best way to approach this problem as I will need to check other fields in the table for duplicate entries as well.
Thanks
Bill
Private Sub Hull_Number_AfterUpdate()
Dim temp As Variant
temp = DLookup("[File_Number]", "[Vessel]", "[Hull_Number] = Forms![Hull_Number]")
MsgBox temp
End Sub
However, the result is always null even though the duplicate record exists in the table.
Having only a basic knowledge of Access, I need a little help in understanding the best way to approach this problem as I will need to check other fields in the table for duplicate entries as well.
Thanks
Bill