tags:

views:

488

answers:

6

Is there a keyboard shortcut in Access 2003 that will run a query while in design or sql mode?

+1  A: 

It's not built-in. I would try a macro - AutoKeys? You should be able to make almost any keyboard short you want that way.

Galwegian
A: 

Does Alt Q Alt R (ie menu item selection) not suit?

Remou
+1  A: 

I used a combination of the answers writing a little function that is called from the AutoKeys macro like so:

Public Function RunMyQuery() As Boolean
   SendKeys "%Q" & "R"
   RunMyQuery = True
End Function

Thanks!

Buggabill
+1  A: 

Sendkeys is always a mistake because almost nothing in Access not doable via code.

The correct code is:

DoCmd.RunCommand acCmdRun

How you run that code is up to you, but it's definitely preferable to SendKeys.

--
David W. Fenton
http://dfenton.com/DFA/

David-W-Fenton
A: 

This function isn't built in, but you can set it up so you can press the F5 function key to run the query.

1 - Create a new macro.

2 - Use the menu, View > Macro Names to add the "Macro Names" column to the grid if it's not already showing.

3 - Type this in the "Macro Names" column:

{F5}

4 - In the "Action" column, scroll down and select "RunCommand."

5 - The bottom half of the window pane is "Action Arguments." For "Command," scroll down and select "Run."

6 - Save the macro as AutoKeys.

7 - Close the macro.

8 - Open a saved query in design view or sql view.

9 - Press the function key, F5, to run the query.

Chris OC
A: 

CTRL+comma and CTRL+dot will let MS Access cycle left and right through the query views Design, Datasheet, SQL, PivotTable, PivotChart.

Otherwise, you can right click on the "Run" exclamation mark and select customize, then with that customize window open, you can right click on the "Run" exclamation mark again, select "Image and Text" to show the word Run. As long as the word is shown, you can use ALT+SHIFT+R to activate that button based on the underlined capital R. If you right click on the "Run" exclamation mark again and select properties, you can change the capital R to a lowercase r so that the SHIFT key isn't needed and the shortcut simply becomes ALT+R.