can i create message

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Can I create message boxes on a yes/no drop down menu with a mac

Can I create message boxes on a yes/no drop down menu with a mac

resolvedResolved · Urgent Priority · Version 2007

Astley has attended:
Access Advanced course

Can I create message boxes on a yes/no drop down menu with a mac

Hi, Is it possible to create a macro pop-up message box on a yes/no combo drop down selection menu on ms access 2007? I've created a form titled Admin staff and a label text box entitled "Is this a tentative booking?" - when the user selects yes a pop message will be displayed and when the user selects no, again a message box will be displayed with a different message...if so, how can this be done? I've been using code in ms access 2003 which works...but when I implement the code in 2007 I receive error messages. Thanks for your clever suggestions....


Private Sub Combo1_AfterUpdate()

Dim MsgAnswer As Integer

On Error Goto Error_Handling

If Combo1.Value = "Yes" Then
MsgAnswer = MsgBox("Is this a tentative booking?", vbYesNoCancel)
If MsgAnswer = vbYes Then
'Add code to open the form
ElseIf MsgAnswer = vbNo Then
'Add code for selecting No
Else
'Cancel the operation
End If
Else
'Use the above format to code for other situations
End If

Exit Sub
Error_Handling:
MsgBox Err.Description, vbCritical

End Sub

RE: Can I create message boxes on a yes/no drop down menu with a

Hi Astley
Thanks for your question

Can you tell me what the error numbers and error descriptions are. This will help me track the problem down

Thanks

Stephen

RE: Can I create message boxes on a yes/no drop down menu with a

Certainly, the following message was displayed: " The expression After Update you entered as the event property setting produced the following error: Only comments may appear after End Sub, End Function, or End Property."


"This error occurs when an event has failed to run because Microsoft Office Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =[Field], this error occurs because Access expects a macro or event name to run when the event is fired."


Thanks


Astley

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Remove spaces in a table

If you have a table that has too many space marks littered around, you can create a update query and use the trim function to get rid of any excess space marks

View all Access hints and tips


Server loaded in 0.08 secs.