Hello All,
Below is the code that I use for searching an existing record in a form after entering the "ProductNo":
My question is...After the message, how can I have Access go to the existing record in the same form?
Thanks, in advance, for responding.
Tony
Below is the code that I use for searching an existing record in a form after entering the "ProductNo":
Private Sub ProductNo_BeforeUpdate(Cancel As Integer)
Dim varX As Variant
varX = DLookup("[ProductNo]", "tbLProducts", "[ProductNo] = '" & Forms!frmProducts.[ProductNo] & "'")
If Not IsNull(varX) Then
MsgBox [ProductNo].Value & " already exists as a product number"
Me.Undo
Cancel = True
Else
'do nothing!
End If
End Sub
Dim varX As Variant
varX = DLookup("[ProductNo]", "tbLProducts", "[ProductNo] = '" & Forms!frmProducts.[ProductNo] & "'")
If Not IsNull(varX) Then
MsgBox [ProductNo].Value & " already exists as a product number"
Me.Undo
Cancel = True
Else
'do nothing!
End If
End Sub
My question is...After the message, how can I have Access go to the existing record in the same form?
Thanks, in advance, for responding.
Tony