data validation for duplicates...

  • Thread starter Thread starter andrew v via AccessMonster.com
  • Start date Start date
A

andrew v via AccessMonster.com

i'm a using a vb code for data duplication in the afterupdate event and i'm
getting an error message when it gets to "elseif"

Private Sub CustomerID_AfterUpdate()
Dim strwhere As String
Dim varresult As Variant

With Me.CustomerID
If (.Value = .OldValue) Or IsNull(.Value) Then
'do nothing
ElseIf (when i press enter to enter the next arguments the error
"Compile error: expected expression comes up)
 
sorry, the rest of it is going to go like this. i got this vb from one of
the other threads. thanks...


strwhere="[CustomerID]="& .value
varresult = dlookup("CustomerID","tblCUSTOMER INFO",strwhere)
if not isnull(varResult) then
Msgbox "Duplicate Customer ID" & varResult
end if
end if
end with
 
Back
Top