MsgBox based upon Combo Box Selection

G

Guest

I would like for a simple Message Box to display if a user selects certain
items from a combo box. The Combo Box has 3 selections AT, OT, BT. When a
user selects AT from the combo box in the form, I would like for a message to
display: "Make sure to enter comments for Above Target performance". I would
like for a different message to display when they select BT, "Make sure to
enter comments for Below Target performance."
I am not very well versed in VB code but I was thinking that it should go in
the AfterUpdate Event of the combo box.

The combo box name is ONE, the Form name is EvaluationForm. The values in
the combo box are 3, AT, 2, OT, 1, BT from a value list.

Any help would be greatly appreciated.
 
G

Guest

Try this ...

Place the following code in the OnClick event of a listbox, or OnChange
event of a combo box:
---------------------------------------------
select case ctlOne.column(1).value
case "AT"
MsgBox "type message here ..."
case "BT"
MsgBox "type message here ..."
case "OT"
MsgBox "type message here ..."
end select
 
F

fredg

I would like for a simple Message Box to display if a user selects certain
items from a combo box. The Combo Box has 3 selections AT, OT, BT. When a
user selects AT from the combo box in the form, I would like for a message to
display: "Make sure to enter comments for Above Target performance". I would
like for a different message to display when they select BT, "Make sure to
enter comments for Below Target performance."
I am not very well versed in VB code but I was thinking that it should go in
the AfterUpdate Event of the combo box.

The combo box name is ONE, the Form name is EvaluationForm. The values in
the combo box are 3, AT, 2, OT, 1, BT from a value list.

Any help would be greatly appreciated.

The Combo AfterUpdate event is fine.
If the Bound Column of the combo box is the column that contains the
number value 1, 2, or 3, you can use:

Dim strMessage As String
strMessage = Choose(ComboName, "Message 1", "Message 2", "Message 3")
MsgBox strMessage

If the bound column is not the column that contains the numbers, you
can use:

Dim strMessage As String
strMessage = Choose(ComboName.Column(x), "Message 1", "Message 2",
"Message 3")
MsgBox strMessage

Where (x) is the number of the column that contains the number value
1,2, or 3. Combo boxes are zero based, so Column(1) is the second
column.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top