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

can i create message

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

ResolvedVersion 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:

Closing form after a certain time period

To make a form close automatically after a certain time period, you need to assign the close function to a macro.

Save the macro and ope up the form in design view. open the Properties sheet.

In the TimerInterval property enter the length of time you want the form open for. This should be in milliseconds, so for instance if you want the form open for 5 seconds enter 5000, for an minute enter 60000.

You now need to attach your macro (to execute the Close action) to the OnTimer event property of the form.



View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.