G
Guest
I have a form (LOCATIONS) with a combo box. The NotInList property is set to
yes. I created a new form (Add New) with data entry set to yes. If an
account number is typed into the combo box and not found, I want to open the
Add New form and enter the data. When I close that form, and go back to the
Locations form I want to type in the number I just added and bring up the
record. So I assume this form has to close and reopen somewhere along the
line.
Here is the code I have for the NotInList event.
Private Sub Combo48_NotInList(NewData As String, Response as Integer)
Dim strMsg As String, strTitle As String
strMsg = "Account Not Found. Add New Account?"
strTitle = "Add New Account?"
If MsgBox(strMsg, vbQuestion + vbYesNo, strTitle) = vbYes Then
DoCmd.OpenForm "AddNew",,,,acFormAdd, acDialog
response = acDataErrAdded
Else
response = acDataErrContinue
End If
Exit_Combo48_NotInLList:
End Sub
At what point would I close and reopen Locations?
Also, I need some error handling, which I haven't had any luck adding.
Thanks,
yes. I created a new form (Add New) with data entry set to yes. If an
account number is typed into the combo box and not found, I want to open the
Add New form and enter the data. When I close that form, and go back to the
Locations form I want to type in the number I just added and bring up the
record. So I assume this form has to close and reopen somewhere along the
line.
Here is the code I have for the NotInList event.
Private Sub Combo48_NotInList(NewData As String, Response as Integer)
Dim strMsg As String, strTitle As String
strMsg = "Account Not Found. Add New Account?"
strTitle = "Add New Account?"
If MsgBox(strMsg, vbQuestion + vbYesNo, strTitle) = vbYes Then
DoCmd.OpenForm "AddNew",,,,acFormAdd, acDialog
response = acDataErrAdded
Else
response = acDataErrContinue
End If
Exit_Combo48_NotInLList:
End Sub
At what point would I close and reopen Locations?
Also, I need some error handling, which I haven't had any luck adding.
Thanks,