Excellent question. I had a feeling you were going to ask that.May I ask you: It's interesting to me, in CheckBoxes I know that "Yes"/"No" stand for "0"/"1" or "-1"/"0",
From your example I learnt that in the MessageBox "Yes" stands for "6", not "0" or "1" or "-1" as assummed.
Well, I got some problems with the new macro design in 2010.If you're using Access 2010, designing macros in the new Logic Designer is way easier than previous versions.
Be professional, use Runtime and Developer.After creating a product, customer couldn't run the Macro in 2007, I had to change the macro to VBA.. and there's no option of Save As previous version..
The Access Runtime is a redistributable program that allows people who do not have Access installed on their computers to use Access database applications. When you open an Access database by using the Access Runtime, the database opens in runtime mode.
The following Access features are not available in runtime mode:
The Navigation Pane is not available in runtime mode. This helps prevent users from accessing arbitrary objects in your database application. Only those objects that you expose to users — for example, by providing a switchboard form — can be opened while using runtime mode. You cannot make the Navigation Pane available in runtime mode.
By default, the Ribbon is not available in runtime mode. This helps prevent users from creating or modifying database objects, and from performing other potentially harmful actions, such as connecting to new data sources or exporting data in ways that you do not intend. You can create a custom Ribbon, and then associate that Ribbon with a form or report. You cannot expose the default Ribbon tabs in runtime mode.
Design view and Layout view
Design view and Layout view are not available for any database objects in runtime mode. This helps prevent users from modifying the design of objects in your database application. You cannot enable Design view or Layout view in runtime mode.
By default, integrated Help is not available in runtime mode. Because you control what functionality is available in your runtime mode application, some of the standard integrated Access Help may be irrelevant to people who use your application, and could potentially confuse or frustrate them. If you are using the Access Developer Extensions to package and deploy your database application, you can provide a custom Help file with your runtime mode application.
Hi can I ask what the 52 refers to in this code?Hi,
Could you please let us know which version of Access you are using? That will definitely help people replying to your question.
To answer your original question, yes you can certainly display a Yes/No message box from a macro and then take different action on what button is clicked.
In Access 2010, conditional logic in macros is way easier than previous versions, but it is still possible in previous versions; it's just a little more tricky.
Here's a quick example using Access 2007 in case you are using that version.
For the first line of this sample macro, enter this in the Condition column:
6<>MsgBox("Please click one of the buttons.",52)
In the Action column on the first time, use the MsgBox macro action and display a message that says "You clicked No."
On the second line of this macro, enter three dots ... in the Condition column to apply the condition from the previous line. In the Action column for the second line, use the StopMacro action.
On the third line of this sample macro, don't put anything in the Condition column. In the Action column of this third line, use the MsgBox macro action and display a message that says "You clicked Yes."
Save the macro and then run it to try it out.
You'll get a Yes/No message prompt that asks you to click a button. If you click the No button, you'll see a message box saying you clicked No and then the macro stops. If you click Yes, you'll see a message box saying you clicked Yes and then the macro stops.
In the sample example I provided, I used Yes/No buttons, a warning message box (the one with the exclamation point icon), and I was testing to see if they clicked the Yes button. You can modify this to present different options using the MsgBox function.
Hope that helps,
Jeff Conrad - Access Junkie - MVP Alumnus
SDET II - Access Test Team - Microsoft Corporation
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010 Info: http://www.AccessJunkie.com
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
What documentation? I understand what you mean about how the bits are made up but im not using vba im using the conditions in a macro and just need to know how to change the icon from a warning triangle to a critical icon.Look up MsgBox in the documentation.
The second argument specifies what is shown on the popup dialog box, bitwise. So you can specify, e.g., vbInformation + vbYesNo etc, each component having some bit value and the total makes up 52 here. Try it.