Run A Query
acCmdRun
A very long winded way of running a query.
'***************** Code Start *******************
' Code by Terry Wickenden
Sub QueryRun(strPass As String)
Dim strMsg As String
On Error GoTo Errhandler
DoCmd.OpenQuery strPass, acViewDesign
DoCmd.RunCommand acCmdRun
SubExit:
Exit Sub
Errhandler:
Select Case Err.Number
Case 7874 'probably wrong name for query
strMsg = strPass & " is not a valid query name."
strMsg = strMsg & vbCrLf & "Please try again"
MsgBox strMsg
Resume SubExit
Case Else
strMsg = Err.Number & vbCrLf & Err.Description
MsgBox strMsg
Resume SubExit
End Select
End Sub
'****************** Code End ********************