T
The Joker via AccessMonster.com
Hello All,
I am working on a pretty basic "add to combo box" function. What I am
looking for is the user to have the option if they would like to add the new
information to the combo box. If they do it gets added (which works fine),
If they choose no I want them still to be able to submit the information in
the form but just not have it added to the combo box. How I currently have
it they have to add it or they can't use it, I get the "The text you entered
isn't in the list" error because I have set Limit to List "Yes". Technically
I don't want to limit to list. Any help will be greatly appreciated. Thanks.
Here is my code:
Private Sub Combo237_NotInList(NewData As String, Response As Integer)
' this is the combo box for prepayment penaltys "add to combo" feature
DoCmd.SetWarnings (False)
Dim strSql As String
If MsgBox(NewData & " is not in list, would you like to add it?", _
vbYesNo + vbQuestion) = vbYes Then
strSql = "insert into tbl_GSPrepaypen (Prepayment) values('" & NewData &
"')"
CurrentDb.Execute strSql
Response = acDataErrAdded
End If
DoCmd.SetWarnings (True)
End Sub
I am working on a pretty basic "add to combo box" function. What I am
looking for is the user to have the option if they would like to add the new
information to the combo box. If they do it gets added (which works fine),
If they choose no I want them still to be able to submit the information in
the form but just not have it added to the combo box. How I currently have
it they have to add it or they can't use it, I get the "The text you entered
isn't in the list" error because I have set Limit to List "Yes". Technically
I don't want to limit to list. Any help will be greatly appreciated. Thanks.
Here is my code:
Private Sub Combo237_NotInList(NewData As String, Response As Integer)
' this is the combo box for prepayment penaltys "add to combo" feature
DoCmd.SetWarnings (False)
Dim strSql As String
If MsgBox(NewData & " is not in list, would you like to add it?", _
vbYesNo + vbQuestion) = vbYes Then
strSql = "insert into tbl_GSPrepaypen (Prepayment) values('" & NewData &
"')"
CurrentDb.Execute strSql
Response = acDataErrAdded
End If
DoCmd.SetWarnings (True)
End Sub