Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I use the code below to run an Access DB SELECT Query and place it in an
Excel Worksheet. Is it possible to adapt this code to run APPEND or UPDATE queries using Excel's VBA Editor, and if so how do I go about the revisions? Sub accessQuery(vSQL As String, strTab As String) If conn Is Nothing Then Set conn = New ADODB.Connection If conn.State = adStateClosed Then 'if not active With conn .Provider = "Microsoft.jet.oledb.4.0" .Mode = adModeShareDenyWrite .Open data1 End With End If Set rs = New ADODB.Recordset rs.Open vSQL, conn, adOpenStatic, adLockReadOnly Sheets(strTab).Activate sglRows = 2 Cells(sglRows, 1).CopyFromRecordset rs Range("A2").Select rs.Close conn.Close Set rs = Nothing Set conn = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Paste Append from Excel to Access | Excel Programming | |||
Running SQL queries for Access using Excel VBA | Excel Programming | |||
Running Queries to Oracle from Excel 2000 | Excel Programming | |||
Running Access queries from Excel | Excel Programming | |||
use vba in excel to append data in access | Excel Programming |