LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Modify Recorded SQL Query to "Insert, Delete, Update"

I have an sample Access Database. It has 1 table w/ 4 Fields. I have
recorded the following code using Excel's Macro Recorder & MS Query:

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DBQ=C:\Temp.mdb;DefaultDir=C:\Temp;Driver={M icrosoft Access
Driver (*.mdb)};DriverId=281;FIL=MS Access;MaxBuffe" _
), Array( _

"rSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransa ctions=0;Threads=3;UID=admin;UserCommitSync=Yes;" _
)), Destination:=Range("A1"))
.Sql = Array( _
"SELECT Data.EEID, Data.FirstName, Data.LastName, Data.HireDate" &
Chr(13) & "" & Chr(10) & "FROM `C:\Temp`.Data Data" _
)
.FieldNames = True
.RefreshStyle = xlInsertDeleteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = True
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SavePassword = True
.SaveData = True
End With
End Sub

I looked into MS Query - it does not appear to allow insert, delete, update,
etc. functionality, So I don't know how to modify the above code (or record a
macro) to "Insert", "Update" or "Delete" Records rather than "Select" Records.

I did read your posts code located at www.bygsoftware.com & that code
does work if I add the DAO 3.6 Object Library Reference.

Since I am not a programmer, I was hoping not to have to maintain various
types of code.

Question: Can the above code even be modified to do what I am asking?

Thank you for your assistance.

--
Thx
MSweetG222

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F daves Excel Discussion (Misc queries) 3 April 24th 07 04:52 AM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
Disabling "Entire &row/&column" in Delete/Insert Cell Gap Excel Programming 1 March 6th 05 03:42 PM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM
SQL "INSERT INTO" Does not Modify Definition of Target Range No Name Excel Programming 0 February 27th 04 10:13 PM


All times are GMT +1. The time now is 11:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"