RunSql

Run an SQL query.

Syntax
      DoCmd.RunSQL(SQLStatement, UseTransaction)

Key
   SQLStatement    A string expression that's a valid SQL
                   statement for an action or DDL query.

   UseTransaction  Use True (-1) to include this query in
                   a transaction.
                   False (0) = don’t use a transaction

The maximum length of sqlstatement is 32,768 characters.

Examples

'Run an UPDATE query
Dim strSQL As String

strSQL = "UPDATE T_Patients SET T_Patients.status = 2 " & _
"WHERE T_Patients.status = 1 "

DoCmd.RunSQL strSQL

“Run rabbit – run rabbit – Run! Run! Run!” ~ Flanagan and Allen.

Related:

RunDataMacro - Run a named data macro.


© Copyright SS64.com 1999-2013
Some rights reserved