Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default using SQL to query Excel (or Access?) selecting specific row numbe

Using the ODBC connections to query Excel, can one get rows by row number?
for example get rows 10 - 20 in an excel spreadsheet (and while I'm at it,
perhaps specify that the data on rows 10 are to be column headers).
Sounds easy, but can't seem to find a way.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default using SQL to query Excel (or Access?) selecting specific row numbe

See destination option below

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DSN=MS Access Database;" & _
"DBQ=C:\TEMP\PMI Part Log.mdb;" & _
"DefaultDir=C:\TEMP;" & _
"DriverId=25;" & _
"FIL=MS Access;" & _
"MaxBufferSize=2048;" & _
"PageTimeout"), Array("=5;")), Destination:=Range("A1"))

"KingGeezer" wrote:

Using the ODBC connections to query Excel, can one get rows by row number?
for example get rows 10 - 20 in an excel spreadsheet (and while I'm at it,
perhaps specify that the data on rows 10 are to be column headers).
Sounds easy, but can't seem to find a way.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default using SQL to query Excel (or Access?) selecting specific row n

Thanks Joel!
Just to make sure I'm going in the right direction, is the 'Destination
Range' something that refers to the Excel sheet that I'm querying, or to the
table I'm bringing the data back into?
In your example, the Destination was A1; if I wanted to retrieve data
starting on the 10th row of an Excel spreadsheet, would I use A10 as the
Destination?
Then how would I specify only 10 rows to be read in?
What I'm fearing is that A1 in your example specifies where to 'put' the
data in the current table once its read, but maybe I'm wrong; I haven't used
the Destination option before.

"Joel" wrote:

See destination option below

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DSN=MS Access Database;" & _
"DBQ=C:\TEMP\PMI Part Log.mdb;" & _
"DefaultDir=C:\TEMP;" & _
"DriverId=25;" & _
"FIL=MS Access;" & _
"MaxBufferSize=2048;" & _
"PageTimeout"), Array("=5;")), Destination:=Range("A1"))

"KingGeezer" wrote:

Using the ODBC connections to query Excel, can one get rows by row number?
for example get rows 10 - 20 in an excel spreadsheet (and while I'm at it,
perhaps specify that the data on rows 10 are to be column headers).
Sounds easy, but can't seem to find a way.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default using SQL to query Excel (or Access?) selecting specific row n

Destinationis the worksheet in excel starting location. It is MAXRECORDS
(ignore blanks rows I added below)

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DSN=MS Access Database;" & _
"DBQ=C:\TEMP\PMI Part Log.mdb;" & _
"DefaultDir=C:\TEMP;" & _

-----------------------------------------------------------
"MaxRecords=10;" & _

--------------------------------------------------------------
"DriverId=25;" & _
"FIL=MS Access;" & _
"MaxBufferSize=2048;" & _
"PageTimeout"), Array("=5;")), Destination:=Range("A1"))


"KingGeezer" wrote:

Thanks Joel!
Just to make sure I'm going in the right direction, is the 'Destination
Range' something that refers to the Excel sheet that I'm querying, or to the
table I'm bringing the data back into?
In your example, the Destination was A1; if I wanted to retrieve data
starting on the 10th row of an Excel spreadsheet, would I use A10 as the
Destination?
Then how would I specify only 10 rows to be read in?
What I'm fearing is that A1 in your example specifies where to 'put' the
data in the current table once its read, but maybe I'm wrong; I haven't used
the Destination option before.

"Joel" wrote:

See destination option below

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DSN=MS Access Database;" & _
"DBQ=C:\TEMP\PMI Part Log.mdb;" & _
"DefaultDir=C:\TEMP;" & _
"DriverId=25;" & _
"FIL=MS Access;" & _
"MaxBufferSize=2048;" & _
"PageTimeout"), Array("=5;")), Destination:=Range("A1"))

"KingGeezer" wrote:

Using the ODBC connections to query Excel, can one get rows by row number?
for example get rows 10 - 20 in an excel spreadsheet (and while I'm at it,
perhaps specify that the data on rows 10 are to be column headers).
Sounds easy, but can't seem to find a way.

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
Can I use MS Query in Excel like an Append Query in Access Sam Wardill Excel Discussion (Misc queries) 0 April 11th 06 02:41 PM
Run Access query from Excel, input value to query being value in c Nagesh Excel Programming 3 December 22nd 05 02:00 PM
Access query to specific cells Cyberwolf Excel Programming 1 July 8th 05 08:27 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM
Can You Query Specific Access Records from Excel? neptune[_2_] Excel Programming 1 May 7th 04 09:07 PM


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