Hi Robin,
Two possibilities to import only the data you need:
1) Get selected columns only, using a query into the worksheet (you have
to specify a contiguous range on the worksheet, but don't have to import
all the columns). The syntax is along these lines:
SELECT F1 AS MyField1, F3 AS MyField2, F25 AS MyField3
INTO MyNewTable
FROM [Excel 8.0;HDR=No;database=C:\Book.xls;].[Sheet1$]
WHERE F2 = 'Something'
;
or
SELECT Field1, Field3, Field25
INTO MyNewTable
FROM [Excel 8.0;HDR=Yes;database=C:\Book.xls;].[Sheet1$A2:E2000]
WHERE F2 < 200
;
Note the default field names F1, F2... if there are no column headers in
the Excel range. You can use a range name instead of a sheet name; in
that case don't use the $.
The problem with (1) is that as far as I know it still has to pull all
the data across the network in order to decide what needs to be
imported. So:
2) Use a script on the server to run a query that extracts only the data
you need, and then just download that. This doesn't mean running Excel
or Access on the server (which might upset your netadmin people),
although it does need to be a Windows server. The script, in any
OLE-aware language, can use the DAO or ADO libraries to run the query
and put the results into a text file, workbook or Access database.
BTW, is the 140MB spreadsheet the actual data store, or is it merely
output from a proper database? If the former, it's alarming; if the
latter, could you get the DB admins to create a query for you and give
you access to it?
>An alternative came to me - if I can't limit the columns (beyond a
>contiguous range), is there a way to limit rows? This file has about 24,000
[quoted text clipped - 17 lines]
>>
>> Robin
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
Robin - 30 Apr 2006 18:26 GMT
Hi John
I've been so blinded by DoCmd.TransferSpreadsheet that I didn't see the wood
for the trees. The Maketable Query suggestion does just great! I'm
developing this off-site and have a test network with a throttled wireless
hop to simulate the bandwidth problem, and in this test environment, the
Query alternative speeds things up by at least a factor of 5 or 6.
Thank you very much John.
I love this News Group!
Regards
Robin
PS The 140MB file is a weekly report output from Seibel.
> Hi Robin,
>
[quoted text clipped - 67 lines]
>
> Please respond in the newgroup and not by email.