View Full Version : MESSAGE POP UP ON COMBO SELECT
stevembe
07-25-2014, 03:24 AM
Hoping someone can help.
I have a database with a combo box in a form with three possible selections:
Permanent
Sub-Contractor
Other
What I want to achieve is if Permanent is selected no message pops up. However, if Sub-Contractor is selected I want a pop up message saying "Refer call to Extension 1234" and if Other is selected a pop message saying "Refer call to extension 4567"
Can anyone advise on how best I can achieve this?
Store the text in a hidden column.
Private Sub Combo0_Click()
If Combo0.Column(1) <> "" Then MsgBox Combo0.Column(1)
End Sub
Private Sub Form_Load()
Combo0.RowSourceType = "value list"
Combo0.RowSource = "Permanent;;Sub-Contractor;Refer call to Extension 1234;Other;Refer call to extension 4567"
Combo0.ColumnCount = 2
Combo0.ColumnWidths = Combo0.Width & ";0"
End Sub
stevembe
07-25-2014, 05:37 AM
Store the text in a hidden column.
Private Sub Combo0_Click()
If Combo0.Column(1) <> "" Then MsgBox Combo0.Column(1)
End Sub
Private Sub Form_Load()
Combo0.RowSourceType = "value list"
Combo0.RowSource = "Permanent;;Sub-Contractor;Refer call to Extension 1234;Other;Refer call to extension 4567"
Combo0.ColumnCount = 2
Combo0.ColumnWidths = Combo0.Width & ";0"
End Sub
Thank you so much for your post but I am not so clever with Access. Can you explain what you mean by store the text in a hidden column and where should I insert the VB? Sorry to be a pain!
Create a form and add a combo to it.
Go into the form module and paste the above code.
Run the form and test it.
This is basic stuff, so if you need more instruction than that (not to be rude or anything) you need to read up on Access a little before you go any further with your project.
In the above code I have explicitly set the data for the combo when the form loads. This is just as an example.
If you currently load the data from a table, add a new column for the message box text. Leave rowsourcetype as is and update the sql for rowsource to include the new column.
By setting a column's width to 0 you can still reference it, but the user can't see it.
stevembe
07-29-2014, 01:08 AM
Create a form and add a combo to it.
Go into the form module and paste the above code.
Run the form and test it.
This is basic stuff, so if you need more instruction than that (not to be rude or anything) you need to read up on Access a little before you go any further with your project.
In the above code I have explicitly set the data for the combo when the form loads. This is just as an example.
If you currently load the data from a table, add a new column for the message box text. Leave rowsourcetype as is and update the sql for rowsource to include the new column.
By setting a column's width to 0 you can still reference it, but the user can't see it.
jonh, thank you so much for your detailed response, it works and is a great help so thank you for your patience. I am reading up on Access as well as obtaining great advice from people like yourself. Enjoy the day!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.