Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Querytable range name

Hi all,

I have created a query that will gather specific
information for a specific account and specific dates.
Since the account numbers and date ranges are not
sequential I can't just grab a bounded range of data but
have to call back to database for each specific piece.

The issue comes in that for every callback to the database
the query is creating a defined name for the cell. I have
tried a number of ways to drop the name but none have
worked. What makes it more challenging is that the a
number of the cells are named so if I do an explicit
name.delete after the query has been populated to that
cell naturally it deletes the name I want to keep, not the
default name the query gave it.

What follows is the code I am using.

Do
DoEvents:
'setting up and running query.
'designing connection string and table destination
With Worksheets("Data Input").QueryTables.Add
(Connection:=Array(Array( _
"ODBC;DSN=Visual FoxPro
Tables;UID=;PWD=;SourceDB=" & DataBase_Location
& ";SourceType=DBF;Exclusive=No;BackgroundFet" _
), Array
("ch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;" )),
Destination:=ActiveCell.Offset(x, 0))
'SQL string
.CommandText = Array( _
"SELECT auttrx.amount" & Chr(13) & "" & Chr(10) & _
"FROM auttrx auttrx" & Chr(13) & "" & Chr(10) & _
"WHERE (auttrx.fund='" & strFundID & "') AND
(auttrx.del_time='') AND " & _
"(auttrx.start_date<={d '" & datRptAsOfDate & "'})
AND " & _
"(auttrx.end_date={d '" & datRptAsOfDate & "'})
AND (auttrx.acct_dr='" & _
Account(ActiveCell.Offset(x, -6).Value) & "') AND
(auttrx.inactive<'Y')")
'AND (auttrx.del_date Is Not Null)

'setting query properties
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = False
.Refresh BackgroundQuery:=False
End With

Any ideas? Thanks for the help.

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
How to use QueryTable with insertion sql ou Excel Programming 1 August 18th 04 12:20 PM
Bad QueryTable Row Count igneramos[_3_] Excel Programming 0 January 27th 04 10:21 PM
Neet to get range of newly added QueryTable Tom Ogilvy Excel Programming 1 January 27th 04 09:44 PM
Querytable Ben.c Excel Programming 4 December 3rd 03 09:11 AM
MS QUERY w/out querytable No Name Excel Programming 1 October 24th 03 03:55 PM


All times are GMT +1. The time now is 10:01 PM.

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"