Access/VBA Library

ExecuteQuery

Executes a query (like UPDATE, DELETE, etc.).

Syntax

ExecuteQuery( query )
Parameters
Name Type Description
query String Required.
Code
Sub ExecuteQuery(query As String)
    Const cFunctionName = "ExecuteQuery"

On Error GoTo ExecuteQuery_Error

    CurrentDb.Execute query, dbFailOnError

ExecuteQuery_Exit:
    On Error Resume Next
    
    Exit Sub

ExecuteQuery_Error:
    ShowError functionName:=cFunctionName
    Resume ExecuteQuery_Exit

End Sub

Databasetag:DatabaseSQLtag:SQL

Remarks

  • When an error occured, a errormessage will pop up.

See also

  • ShowError