Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default An ODBC question

I have been using the following to query a database through ODBC:

With ActiveSheet.QueryTables.Add(Connection:="ODBC;DATA BASE=DB;
UID=user;PWD=password;DSN=sDSN, Destination:=Range("A1"), Sql:=sSQL)
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.PreserveColumnInfo = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With

If sSQL is a SELECT, there is no problem. If it is a DELETE, I have to
set 'Refresh BackgroundQuery' to True. Otherwise I will get an
Application Defined or Object Defined error. What was wrong?
Reply
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
Complicated ODBC data refresh question. JDNETTC Excel Discussion (Misc queries) 6 January 30th 08 11:36 PM
ODBC bnkone Excel Discussion (Misc queries) 0 February 15th 06 09:38 PM
Shared xls using ODBC/JET matteodipane Excel Discussion (Misc queries) 0 December 6th 05 02:26 PM
ODBC Lynn Excel Discussion (Misc queries) 3 November 1st 05 04:16 PM
Oracle odbc Slinjger Excel Discussion (Misc queries) 1 July 3rd 05 04:35 PM


All times are GMT +1. The time now is 08:09 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"