Undo Itemcode

S

SG

I have the following behind a list box on a subform but it does not see to be working the vbNo section, if I select No the itemcode which the user typed in should be undone but nothing is happening any ideas anyone??




Private Sub itemcode_NotInList(NewData As String, Response As Integer)


If MsgBox("The Itemcode cannot be found enter now?", _
vbYesNo) = vbYes Then
DoCmd.OpenForm "enter new product details", , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded

If vbYesNo = vbNo Then
Me.Undo
Cancel = True

Else
Response = acDataErrContinue
End If

End If

End Sub



Many Thanks


S
 
S

SG

Damian,

Perfect - Thankyou

If I answer yes the the question how can I copy the itencode typed in by the
user and have this displayed in the itemcode field of the "Enter New Product
Details" form to avoid the user having to type the itemcode again?

Thanks for the help!

S
 
D

Damian S

Hi again SG,

Depending on where else you can open the add item form from, you could pass
the value as a parameter to the form, or you could have an on open event that
grabs the value from your other form eg:

me.txtItemCode = forms!OTHERFORM.ItemCode

Hope this points you in the right direction.

Damian.
 
Top