PDA

View Full Version : How to create a yes/no pop box on a drop down/combo list box with a message?



wedd
09-19-2010, 07:59 AM
I created a yes no drop down box on ms access 2007 home edition which i would like a message box to pop up with a message for each option chosen. I'm able to do this with a list of various names of things...but with the yes/no option I am finding it difficult to give me this option with either a macro or vba code for the user to select either yes or no with a pop up message showing...any advise...??All i get is a message type mismatch...when I run the macro...and when i run the code using vba nothing happens...


Thanks for you vba knowledge...:friends:

Movian
09-21-2010, 06:53 AM
If i understand this correctly, after the user selects yes or no from your drop down you want to show a message box based on their selection. You should be able to do that with something similar to the following in the afterupdate event of the drop down box.

Private Sub Dropdown_Afterupdate()
select case ucase(me.dropdown)
case "YES"
msgbox "Msgbox text for yes selection in drop down"
case "NO"
msgbox "Msgbox text for no selection in drop down"
case else
msgbox "The user typed something directly into the drop down OR an error has occurred"
end select
end sub

wedd
09-21-2010, 07:10 AM
That's correct! The user select yes from the drop down a message promts "etc" and the same if the user selects no from the menu...thanks.

Movian
09-21-2010, 07:13 AM
Glad to hear it.

Please make sure to mark your threads solved if you question has been answered. Under Thread Tools

wedd
09-21-2010, 07:45 AM
Yes, i know it should do the trick...i've adapted your code to my drop down menu...i know it should work because i was reading in a vba book on similar code to do this...but when i clicked on the drop down menu nothing happened on yes or no...maybe it could be something else..ive tried vba to ask yes and no questions and always have the same issue...

Movian
09-21-2010, 08:00 AM
Did you add the code to the after update event for the drop down?

Could you post the code that you have from your system so i can see what you have "Adapted". I'm presuming its just the drop down name
.

How did you put the code in ? did you select the drop down, then under properties go to the events tab then select after update then code editor ?

if you can give me this information i will be able to look at this further for you :)

wedd
09-21-2010, 08:06 AM
Yes, I went through those steps and applied the code to my drop down...i'll send you the code