J
James P.
Help,
In Access 2000, I have bound column - comboBox called cboPriority. In
design, I put in three values: High, Low, Medium. The default value
is Medium. When I run the form, it shows the default value in the
comboBox, and those values in the list, without any problem.
The problem is if I highlight the value in the comboBox, spacebar (to
erase the default value "Medium"), and hit Tab (to get out of the
comboBox), I got an error message saying: "You tried to assign the
Null value to a variable that is not a Variant data type".
I would like to display an appropriate message before this error
message comes out. I think the most appropriate place to put my
msgbox is in the Change event so I check for Null value here like:
Private sub cboPriority_Change
If IsNull(cboPriority) or cboPriority = "" then
msgbox ""Please select a value from the list"
exit sub
End If
End Sub
However, if I put a break in the code here, do the action above:
highlight, spacebar, Tab: I saw cboPriority still shows the default
value "Medium" so it never executes my message box code.
I also tried to capture the error message before it comes out with my
own message box in Lost Focus, Exit, Before Update and After Update
events of this comboBox but so far this error message keeps coming out
first.
Any help and suggestions are appreciated.
James
In Access 2000, I have bound column - comboBox called cboPriority. In
design, I put in three values: High, Low, Medium. The default value
is Medium. When I run the form, it shows the default value in the
comboBox, and those values in the list, without any problem.
The problem is if I highlight the value in the comboBox, spacebar (to
erase the default value "Medium"), and hit Tab (to get out of the
comboBox), I got an error message saying: "You tried to assign the
Null value to a variable that is not a Variant data type".
I would like to display an appropriate message before this error
message comes out. I think the most appropriate place to put my
msgbox is in the Change event so I check for Null value here like:
Private sub cboPriority_Change
If IsNull(cboPriority) or cboPriority = "" then
msgbox ""Please select a value from the list"
exit sub
End If
End Sub
However, if I put a break in the code here, do the action above:
highlight, spacebar, Tab: I saw cboPriority still shows the default
value "Medium" so it never executes my message box code.
I also tried to capture the error message before it comes out with my
own message box in Lost Focus, Exit, Before Update and After Update
events of this comboBox but so far this error message keeps coming out
first.
Any help and suggestions are appreciated.
James