Link to home
Start Free TrialLog in
Avatar of heijmer
heijmer

asked on

msgbox in access

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
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

yes,

private sub combo0_afterupdate()

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

end sub
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of heijmer
heijmer

ASKER

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

Avatar of heijmer

ASKER

where do i find the name of the combo box???
(sorry if that sounds stupid!)
Avatar of heijmer

ASKER

where do i find the name of the combo box???
(sorry if that sounds stupid!)

is this correct?
Avatar of heijmer

ASKER

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

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
Avatar of heijmer

ASKER

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
No, the message box is dependent on the amount of message you want to display but it has its limitations too.
you can create own "message Form"  to show the message and maximize it on open, but it is not advisable
Avatar of heijmer

ASKER

Ok thanks for all your help - 500 points coming your way!!!!!!!!!!!!!!!!!!!!!!