I have a combo box that is populated from a table. If an item is not in the table, I trigger the following code:
Private Sub frm1_Control_NotInList(NewData As String, Response As Integer)
Dim intReply As Integer
intReply = MsgBox("The item'" & NewData & "' is not in the list: Would you like to add?", vbYesNo)
If intReply = vbYes Then
' DoCmd.OpenTable "tbl1", acViewNormal, acAdd
DoCmd.OpenForm "frmAddItemTotbl1", , , , acFormAdd, , NewData
Response = acDataErrAdded
Else
MsgBox "Please select an item from the list"
Response = acDataErrContinue
End If
End Sub
Neither the 'active' DoCmd line or the commented out line work - the active line gives me a 'Not in List' message when the second form opens. The OpenTable line opens the table, but doesn't fill in the field (which I can see is 'correct' because there is nothing to pass NewData to the record).
Is it possible to get NewData to populate a field on the second form (or directly into the table) without having to rekey NewData, or getting an error message?
I am using Access 2000.
Thanks for any help.
Kiwi44



