I have a db one of the tables (TblScans) I have field called ProductName and a field called SapNo and a yes/no field called Repeated
In a form (frmScans) ProductName is entered as Text
then SapNo in its own field
I found from the net a dlookup that i use in SapNo Beforeupdate Event procedure if the Product name has been repeated it deletes it from the form but what I want it to do is change repeated yes /no to yes for that record
Here is the code I use at the moment
Private Sub SapNo_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("ProductName", "TblScans", _
"ProductName = " & Chr$(34) & Me!ProductName & Chr$(34))) _
And Me!ProductName <> Nz(Me!ProductName.OldValue) Then
Me.Undo
DoCmd.Close acForm, "FrmScans", acSaveYes
DoCmd.OpenForm "FrmScans", acNormal
Cancel = True
End If
End Sub
Can someone please help
In a form (frmScans) ProductName is entered as Text
then SapNo in its own field
I found from the net a dlookup that i use in SapNo Beforeupdate Event procedure if the Product name has been repeated it deletes it from the form but what I want it to do is change repeated yes /no to yes for that record
Here is the code I use at the moment
Private Sub SapNo_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("ProductName", "TblScans", _
"ProductName = " & Chr$(34) & Me!ProductName & Chr$(34))) _
And Me!ProductName <> Nz(Me!ProductName.OldValue) Then
Me.Undo
DoCmd.Close acForm, "FrmScans", acSaveYes
DoCmd.OpenForm "FrmScans", acNormal
Cancel = True
End If
End Sub
Can someone please help