RunSQL Macro Action

You can use the RunSQL action to run a Microsoft Office Access 2007 action query by using the corresponding SQL statement. You can also run a data-definition query.

Sponsored Links:

Related Topics

RunSQL statement
Can anybody tell me why this SQL statement won't run in in the RunSQL macro action.

SELECT Open_Issues.* FROM Open_Issues WHERE ((Open_Issues.Account_No)=(Forms.Open_Issues_Viewe r.Text64));

It tells me that the RunSQL action must have an SQL statement for an arguement when I try to run the macro. I thought that was a perfectly valid SQL statement considering I checked it with a query


Hourglass Macro Action
You can use the Hourglass action to change the mouse pointer to an image of an hourglass (or another icon you've chosen) while a macro is running. This action can provide a visual indication that the macro is running. This is especially useful when a macro action or the macro itself takes a long time to run.


RunMacro Macro Action
You can use the RunMacro action to run a macro. The macro can be in a macro group.
You can use this action:
-To run a macro from within another macro.
-To run a macro based on a certain condition.
-To attach a macro to a custom menu command.


Test a macro by using Single Step mode
By single stepping (single stepping: A debugging technique that enables you to run a macro one action at a time or run Visual Basic code one line at a time.) through a macro (macro: An action or set of actions that you can use to automate tasks.), you can observe the flow of the macro and the results of each action (action: The basic building block of a macro; a self-contained instruction that can be combined with other actions to automate tasks. This is sometimes called a command in other macro languages.), and isolate any action that causes an error or produces unwanted results. (Applies to Microsoft Office Access 2007)


CancelEvent Macro Action
You can use the CancelEvent action to cancel the event that caused Microsoft Office Access 2007 to run the macro containing this action. The macro name is the setting of an event property such as BeforeUpdate, OnOpen, OnUnload, or OnPrint.


Run an Access macro by using a keyboard shortcut
You can assign an action (action: The basic building block of a macro; a self-contained instruction that can be combined with other actions to automate tasks. This is sometimes called a command in other macro languages.) or set of actions to a specific key or keyboard shortcut by creating an AutoKeys macro group (macro group: A collection of related macros that are stored together under a single macro name. The collection is often referred to simply as a macro.). When you press the key or keyboard shortcut, Microsoft Office Access performs the action.


Pause a macro
Is there a way to insert an action (or action arguments) to pause a macro action for X amount of seconds before performing the action


PrintOut action
I'm trying to create a macro that will print out 5 reports. I know how to OPEN 5 reports with a macro, with the OpenReport action, but I want to print them. The PrintOut action is not in the drop down list of usable actions in the Macro design view, though.


Transfertext action missing in Macro
I am creating an import macro in Access 2007 and do not have a TransferText action option. My last Action is StopMacro. Do you think it's an installation issue or is there something else I have to download to get that action back? I used it many times in 2003 and researched and found that it's supposed to be in 2007 and can't find anyone else with this problem.


Getting to Know Macros
You can easily add conditions (which make the macro run only under specific criteria) to your macros. You apply a condition to a certain action in the macro sheet and when you run the macro, if the condition is not met, the action is skipped and the next action in the sequence is run. You can make conditions apply to multiple sequential actions by putting an ellipsis() in the next action's Condition column.


SingleStep Macro Action
You can use the SingleStep action to pause macro execution and open the Macro Single Step dialog box.


Error handling macros 2010
I am following the documention in the Help file for Access 2010 (which by the way, the icons they referece here etc don't seem to match what's on screen).

I selected Help, Data Macros, Create Macro and then jumped to the section titled, Debug a Macro, Use the OnError Action.

This section suggests that you create a named Error-handling macro, which I did following their instructions.

Then it suggests you add an OnError action to a data macro. They use the after instert macro for a table in their example, so I did the same. They suggest you drag an OnError action to the screen which I did. On their screen this action has two sections
Macro Name

On my Screen, however, there is only a GoTo field. Is this because these instructions are out dated? Why do their instructions not match what I see on screen. I have a macro I want the onError to go to but I am left to wonder how to tell it so.


conditional macro action
I want a macro I have to do a certain action only if a conduction is matched.

I have something like in condition field

[imprimirpresso].[Pres Lida] Is Not Null

it shows me an error.

How can I make it work in macros


SetValue Macro action
Hai, I am using MS Acess 2010. I have a form using to keep some tool records. All tools are validated and if I enter a tool number in this form which is not validated, through a MsgBox function, another form opens for a validation records. Everything is fine. I want to store the tool number I entered in the first form and copy it to the validation form tool number field without retyping it in the new validation form. I am not familiar with code. I am trying to set the value through macro action window, but I cant find "SetValue" action in the list. But I can see it in the "data macro" action list. Appreciate your help to bring the SetValue in macro action list


SetValue Macro action
I am using MS Access 2010. I have a form using to keep some tool records. All tools are validated and if I enter a tool number in this form which is not validated, through a MsgBox function, another form opens for a validation records.

Everything is fine. I want to store the tool number I entered in the first form and copy it to the validation form tool number field without retyping it in the new validation form.

I am trying to set the value through macro action window, but I can't find "SetValue" action in the list.

But I can see it in the "data macro" action list. Appreciate your help to bring the SetValue in macro action list.


Echo Macro Action
You can use the Echo action to specify whether echo is turned on. For example, you can use this action to hide or show the results of a macro while it runs.


mailmerge macro
I'm trying to build a macro to perform a mail merge. I'm using the macro function and so far can get the macro to begin the mail merge. Access presents me with a pop up box called 'microsoft word mail merge wizard' which then presents you with the window for mail merges.

Is there an action in macro's to click the ok so it brings me to the point where to select the file from.

If this is possible, on the next step can a macro action be created to insert the place to get word document from


LockNavigationPane Action Disables Linked Table Manager
The title pretty much says it all. I am attempting to lock the navigation pane in order to keep users from accessing certain objects so I have an AutoExec macro that disables certain categories and then sets the LockNavigationPane action to true. However, I've noticed that as soon as the macro runs Access grays out the Linked Table Manager. I've confirmed it is the LockNavigationPane action that causes this by running just that one action in the macro and, sure enough, no Linked Table Manager.

This doens't make sense to me, and google hasn't been any help so far. Has anyone encountered this or found a way around it


VBA vs Macro
I have the following code in the AfterUpdate event in a modal form. but if I try putting the code in a macro with the Requery action I get an error 2950. Isthere some reason I can not use the Requery action to update a different form? Or, am I referencing the subform container incorrectly in the macro argument?


my first DoCmd.RunSQL
Not sure what I am doing wrong here, this gives me the error "The RunSQL action requires an argument consisting of an SQL statement":

Option Compare Database

Public Sub test1()

Dim strSQL As String

strSQL = "SELECT AttributeList.Id " & _
"FROM AttributeList;"

DoCmd.RunSQL strSQL

End Sub

Tried it again with no variables. with quotes, no quotes, parenthesis.

Option Compare Database

Public Sub test1()

DoCmd.RunSQL "SELECT AttributeList.Id FROM AttributeList