Hello all,
Having a bit of grief with a NotInList code block that has quit working properly.
I have set it as a public sub in a module so I can use it in multiple forms. I t worked ok in the form module but seems to be a bit glitchy in the public mode.
The new value does not seem to be taking and in spite of "acdataAdde d" it continues to pop up the standard warning telling the user to pick an item from the list after the second message box closes. Ultimately the data doesnt get added.
Combo box source is:
Limit To List is set to - Yes
Code is As Follows:
It is notable that the (New Data) is not appearing in the first message box string when it displays. It shows empty quotes instead where the new Mfg name should appear.
This ones been driving me crazier then I normally am. If someone could point out my blind spot it would be much appreciated.
Thanks in advance
Having a bit of grief with a NotInList code block that has quit working properly.
I have set it as a public sub in a module so I can use it in multiple forms. I t worked ok in the form module but seems to be a bit glitchy in the public mode.
The new value does not seem to be taking and in spite of "acdataAdde d" it continues to pop up the standard warning telling the user to pick an item from the list after the second message box closes. Ultimately the data doesnt get added.
Combo box source is:
Code:
SELECT [tbl_Manufacturers].[MfgrID], [tbl_Manufacturers].[MfgrName] FROM tbl_Manufacturers ORDER BY [tbl_Manufacturers].[MfgrName];
Code is As Follows:
Code:
Public Sub MfgNIL() On Error GoTo MfgNIL_Err Dim IntAnswer As Integer Dim StrSql As String IntAnswer = MsgBox("The Manufacturer " & Chr(34) & (NewData) & _ Chr(34) & " is not currently listed." & vbCrLf & _ "Would you like to add it to the list now?" _ , vbQuestion + vbYesNo, "I-TEAM Utilities") If IntAnswer = vbYes Then StrSql = "INSERT INTO tbl_Manufacturers([MfgrName]) " & _ "VALUES ('" & NewData & "');" DoCmd.SetWarnings False DoCmd.RunSQL StrSql DoCmd.SetWarnings True Response = acDataErrAdded MsgBox "The new Manufacturer has been added to the list." & _ " Please remember to enter remaining contact information" & vbCrLf & _ "as soon as possible to ensure complete records" & vbCrLf & _ "Use the 'Find' control on the 'Manufacturers' form to locate this Manufacturer." _ , vbInformation, "I-TEAM Utilities" Else MsgBox "Please choose a Manufacturer from the list." _ , vbInformation, "I-TEAM Utilities" Response = acDataErrContinue End If MfgNIL_Exit: Exit Sub MfgNIL_Err: MsgBox Err.Description, vbCritical, "Error" Resume MfgNIL_Exit End Sub
This ones been driving me crazier then I normally am. If someone could point out my blind spot it would be much appreciated.
Thanks in advance
Comment