Zippersabrat
Blah Blah Blah :o)
- Local time
- Today, 14:29
- Joined
- May 5, 2010
- Messages
- 31
I am trying to set up an alternative for the default Not In List Message. What I would like is for the item typed into the [Item Name] field of the Purchase Order Detail to be added to the [Inventory List] Form (in the [Item Name] field) and then for the [Inventory List] to be opened to that new entry for editing. I have this so far:
Private Sub Item_Name_NotInList(NewData As String, Response As Integer)
Dim Msg As String
Dim strSQL As String
Msg = MsgBox("'" & NewData & "' is not in on the inventory list. Would you like to add it?", vbQuestion + vbYesNo, "Add Item")
If Msg = vbYes Then
strSQL = "INSERT INTO [Inventory List]([Item Name]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
blnNewListItem = True
DoCmd.OpenForm "Inventory List", , , "[Item Name] = [Item Name]", , acDialog
Response = acErrDataAdded
End If
End Sub
Thanks for your help!
Peggy
Private Sub Item_Name_NotInList(NewData As String, Response As Integer)
Dim Msg As String
Dim strSQL As String
Msg = MsgBox("'" & NewData & "' is not in on the inventory list. Would you like to add it?", vbQuestion + vbYesNo, "Add Item")
If Msg = vbYes Then
strSQL = "INSERT INTO [Inventory List]([Item Name]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
blnNewListItem = True
DoCmd.OpenForm "Inventory List", , , "[Item Name] = [Item Name]", , acDialog
Response = acErrDataAdded
End If
End Sub
Thanks for your help!
Peggy