?
Solved

msgbox in access

Posted on 2011-10-13
11
Medium Priority
?
228 Views
Last Modified: 2012-05-12
Hi there

this is what I want to do

I am creating a form in an access database on which is a drop down box.  

When a user selects a certain option from the drop box I want it to display a message.

Is this simple to do?

Thanks
0
Comment
Question by:heijmer
  • 6
  • 5
11 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36963578
yes,

private sub combo0_afterupdate()

if me.combo0="some options" then
   msgbox "Hello"
end if

end sub
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 36963589
you have to change the name of the combo0 to your actual combo box name and "some options" to the option you want...

you can also, display different messages depending on the options you select

private sub combo0_afterupdate()

select case me.combo0
   case ="option1"
   msgbox "Hello 1"
   case ="option2"
   msgbox "Hello 2"


end select

end sub
0
 

Author Comment

by:heijmer
ID: 36963673
Thanks - tried that but when I switch back to form veiw and select the item on the list that I want to generate a message

nothing happens

Code:

Option Compare Database

Private Sub combo0_afterupdate()

If Me.combo0 = "Issue Around Cost" Then
   MsgBox "Have you found out if the customer could be pursuded by a 10% Discount?"
End If

End Sub

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:heijmer
ID: 36963681
where do i find the name of the combo box???
(sorry if that sounds stupid!)
0
 

Author Comment

by:heijmer
ID: 36963702
where do i find the name of the combo box???
(sorry if that sounds stupid!)

is this correct?
0
 

Author Comment

by:heijmer
ID: 36963704
where do i find the name of the combo box???
(sorry if that sounds stupid!)

is this correct?

Option Compare Database

Private Sub combo0_afterupdate()

If Me.Outcome = "Issue Around Cost" Then
   MsgBox "Have you found out if the customer could be pursuded by a 10% Discount?"
End If

End Sub

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36963713
in the design view of the form, select the combo box and hit F4

select the Event tab, locate the After Update event and click on the Dropdown arrow to the right and select {Event Procedure]
then click on the (...) , this will take you to the VBA window wher you will place the codes

If Me.combo0 = "Issue Around Cost" Then
   MsgBox "Have you found out if the customer could be pursuded by a 10% Discount?"
End If


again, you need to change "combo0" to the name of the combo box
0
 

Author Comment

by:heijmer
ID: 36963847
Fantastic - thats really great.

One more thing is there a way that you maximum the msgbox so it take up the whole screen?

Thanks buddy
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36963866
No, the message box is dependent on the amount of message you want to display but it has its limitations too.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36963879
you can create own "message Form"  to show the message and maximize it on open, but it is not advisable
0
 

Author Comment

by:heijmer
ID: 36963951
Ok thanks for all your help - 500 points coming your way!!!!!!!!!!!!!!!!!!!!!!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Progress
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question