Hello all,
Here's what I'm trying to do:
If a value exists after input, display the message that it already exists in the "archived" version and then open the form of the archived table and display the record of the existing value.
Here's the code I'm using:
The message portion of the code works well but the "archived" form opens without any record and is also "filtered".
Any ideas?
Thanks, in advance, for any help offered.
Tony
Here's what I'm trying to do:
If a value exists after input, display the message that it already exists in the "archived" version and then open the form of the archived table and display the record of the existing value.
Here's the code I'm using:
Private Sub LotNo_BeforeUpdate(Cancel As Integer)
Dim varX As Variant
varX = DLookup("[LotNo]", "tbLArchiveDACS", "[LotNo] = '" & Forms!frmDACS.[LotNo] & "'")
If Not IsNull(varX) Then
MsgBox "LotNo " & [LotNo].Value & " already exists as a product number in ArchiveDacs!"
Me.Undo
Cancel = True
DoCmd.OpenForm "frmArchiveDACS", acNormal, , "[LotNo]= '" & Forms!frmDACS.[LotNo] & "'"
Else
'do nothing!
End If
End Sub
Dim varX As Variant
varX = DLookup("[LotNo]", "tbLArchiveDACS", "[LotNo] = '" & Forms!frmDACS.[LotNo] & "'")
If Not IsNull(varX) Then
MsgBox "LotNo " & [LotNo].Value & " already exists as a product number in ArchiveDacs!"
Me.Undo
Cancel = True
DoCmd.OpenForm "frmArchiveDACS", acNormal, , "[LotNo]= '" & Forms!frmDACS.[LotNo] & "'"
Else
'do nothing!
End If
End Sub
The message portion of the code works well but the "archived" form opens without any record and is also "filtered".
Any ideas?
Thanks, in advance, for any help offered.
Tony