T
Tom
On a form, I have 100+ combo boxes. To make sure that members not enter
additional data (beyond the options of the combo list), I set the combo's
property "Limit to List" = Yes.
Then, if a user attempts to type in an non-valid value, I'd like to throw a
customized message such as:
MsgBox "You must select a value from the list!", vbInformation,
"Information"
However, I don't want to include the same 3 lines 100+ times (one for each
combo box) into my VBA code... as illustrated below:
&&&&&&&&&&&&&&&&&&&&&&&&&
Private Sub Combo1_NotInList(NewData As String, Response As Integer)
MsgBox "You must select a value from the list!", vbInformation,
"Information"
End Sub
Private Sub Combo2_NotInList(NewData As String, Response As Integer)
MsgBox "You must select a value from the list!", vbInformation,
"Information"
End Sub
etc.
etc.
etc.
Private Sub Combo100_NotInList(NewData As String, Response As Integer)
MsgBox "You must select a value from the list!", vbInformation,
"Information"
End Sub
&&&&&&&&&&&&&&&&&&&&&&&&&
Instead, I'd rather have the MsgBox once and just call the same function
from each combo box if invalid data is entered. I did this via the
following method...
&&&&&&&&&&&&&&&&&&&&&&&&&
Function ValueNotInListResponse() As Long
MsgBox "You must select a value from the list!", vbInformation,
"Information"
ValueNotInListResponse = acDataErrContinue
End Function
&&&&&&&&&&&&&&&&&&&&&&&&&
Then, in each combo's "On Not In List" event, I added the following:
=ValueNotInListResponse()
Here's what works:
If invalid data is entered, the customized message pops up
Here's what I need some help with:
After I get the customized message, Access still pops up the default
message:
"The text you entered isn't an item in the list..."
My question: How can I get rid of the 2nd message "The text you entered..."?
The additional line "ValueNotInListResponse = acDataErrContinue" doesn't
seem to work for this.
Thanks,
Tom
additional data (beyond the options of the combo list), I set the combo's
property "Limit to List" = Yes.
Then, if a user attempts to type in an non-valid value, I'd like to throw a
customized message such as:
MsgBox "You must select a value from the list!", vbInformation,
"Information"
However, I don't want to include the same 3 lines 100+ times (one for each
combo box) into my VBA code... as illustrated below:
&&&&&&&&&&&&&&&&&&&&&&&&&
Private Sub Combo1_NotInList(NewData As String, Response As Integer)
MsgBox "You must select a value from the list!", vbInformation,
"Information"
End Sub
Private Sub Combo2_NotInList(NewData As String, Response As Integer)
MsgBox "You must select a value from the list!", vbInformation,
"Information"
End Sub
etc.
etc.
etc.
Private Sub Combo100_NotInList(NewData As String, Response As Integer)
MsgBox "You must select a value from the list!", vbInformation,
"Information"
End Sub
&&&&&&&&&&&&&&&&&&&&&&&&&
Instead, I'd rather have the MsgBox once and just call the same function
from each combo box if invalid data is entered. I did this via the
following method...
&&&&&&&&&&&&&&&&&&&&&&&&&
Function ValueNotInListResponse() As Long
MsgBox "You must select a value from the list!", vbInformation,
"Information"
ValueNotInListResponse = acDataErrContinue
End Function
&&&&&&&&&&&&&&&&&&&&&&&&&
Then, in each combo's "On Not In List" event, I added the following:
=ValueNotInListResponse()
Here's what works:
If invalid data is entered, the customized message pops up
Here's what I need some help with:
After I get the customized message, Access still pops up the default
message:
"The text you entered isn't an item in the list..."
My question: How can I get rid of the 2nd message "The text you entered..."?
The additional line "ValueNotInListResponse = acDataErrContinue" doesn't
seem to work for this.
Thanks,
Tom