PDA

View Full Version : Is it possible to create a message box from a drop down menu using vba or a macro?



wedd
12-23-2010, 03:42 AM
Hi, I'm currently using access 2007. I've developed a form with a drop down list of different venues and a checkbox on my table of each venue that is available for a New Year's eve event. Is it possible to display a messagebox based on the drop down selection and checkbox being ticked or unticked displaying a message - "Venue will be available" or "Venue will not be available" on my form? Also, is it possible to hide the checkbox selection on the form? Is this possible using vba? If so, do you have any examples of code how this can be done? I've read a few vba books and searched websites but haven't seen as yet any ideas how to do this...I am a novice/intermediate user of vba...


Thanks for your contributions:friends:

Imdabaum
12-23-2010, 07:38 AM
Wedd, you most likely won't find specific examples of what you are trying to do for step by step instructions. Try to break it down into smaller phases. Step1: You want a message box with text that is based on the drop down selection.

Sub Alert()
Dim msg as String
Select Case Me.[Yourdropdowncontrol's name]
Case A
msg = "item1"
Case B
msg = "item2"
Case C
msg = "item3"
Case D
msg = "item4"
'Case......
End Select
MsgBox(msg[,title][,iconType])
End Sub


I need clarificaiton on the checkboxes. Are they being taken into account within the message box? Or is this a different message box that would be displayed when the checkbox is ticked/or unticked?

wedd
12-23-2010, 01:35 PM
Yes, Imdabaum, its a different messagebox. Basically when a checkbox is being ticked it should display a message "venue is available" , and when the checkbox is not ticked it will display a message "venue is not available". I hope that is clear...