Monday, 25 June 2012

Ex4: VBA - Modify a query using ADO

Modify a query using ADO in VBA

Function ModifyViewAdo()
    'Purpose:   Modify a query using ADO.
    Dim cn As ADODB.Connection
    Dim strSql As String
    
    strSql = "ALTER TABLE Query1 AS SELECT MyTable.* FROM MyTable;"
    Set cn = CurrentProject.Connection
    cn.Execute strSql
    
    Debug.Print "MyTableView modified"
    Set cn = Nothing
End Function

No comments:

Post a Comment