Hi,
I'm using the code below to check new product# input from a form called frmProducts that is bound to a table called tblProducts.
Private Sub Prod__BeforeUpdate(Cancel As Integer)
Dim varX As Variant
varX = (DLookup([Prod#], "tblProducts", Forms!frmProducts.[Prod#]))
If Not IsNull(varX) Then
MsgBox [Prod#].Value & " already exists as a product #"
Me.Undo
Cancel = True
Else
'do nothing!
End If
End Sub
The problem is that any new product# that you input results in "product already exists".
Thank you very much, in advance, for any help.
Tony Scotti
Montreal
I'm using the code below to check new product# input from a form called frmProducts that is bound to a table called tblProducts.
Private Sub Prod__BeforeUpdate(Cancel As Integer)
Dim varX As Variant
varX = (DLookup([Prod#], "tblProducts", Forms!frmProducts.[Prod#]))
If Not IsNull(varX) Then
MsgBox [Prod#].Value & " already exists as a product #"
Me.Undo
Cancel = True
Else
'do nothing!
End If
End Sub
The problem is that any new product# that you input results in "product already exists".
Thank you very much, in advance, for any help.
Tony Scotti
Montreal