G
Guest
I have coded an Event Procedure "OnNotInList" as follows:
Private Sub SupplierID_NotInList(NewData As String, Response As Integer)
Dim ctrl As Control
Dim strMessage As String
Set ctrl = Me.ActiveControl
strMessage = "Add new Supplier to list?"
If MsgBox(strMessage, vbYesNo + vbQuestion) = vbYes Then
DoCmd.OpenForm "Supplier", _
datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
' ensure supplier has been added
Response = acDataErrAdded
Else
strMessage = NewData & " was not added to Suppliers table."
MsgBox strMessage, vbInformation, "Warning"
Response = acDataErrContinue
ctrl.Undo
End If
End Sub
The form opens, however the Item does not automatically appear in the first
field called Supplier Name. I have done the same for a Suburb table and when
this form opens the Suburb is already there and you can move to type the
relevant PostCode, ZipCode etc
Thanks for any help
Private Sub SupplierID_NotInList(NewData As String, Response As Integer)
Dim ctrl As Control
Dim strMessage As String
Set ctrl = Me.ActiveControl
strMessage = "Add new Supplier to list?"
If MsgBox(strMessage, vbYesNo + vbQuestion) = vbYes Then
DoCmd.OpenForm "Supplier", _
datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
' ensure supplier has been added
Response = acDataErrAdded
Else
strMessage = NewData & " was not added to Suppliers table."
MsgBox strMessage, vbInformation, "Warning"
Response = acDataErrContinue
ctrl.Undo
End If
End Sub
The form opens, however the Item does not automatically appear in the first
field called Supplier Name. I have done the same for a Suburb table and when
this form opens the Suburb is already there and you can move to type the
relevant PostCode, ZipCode etc
Thanks for any help
have an awesome day