Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing Data from Access (or text) to Excel 1

Status
Not open for further replies.

RamziSaab

MIS
May 7, 2003
522
GB
I have the following:

- text file (tab delimited) which has data (generated separately) with around 55 million rows and 5 columns (results from another program)

- i need to be able to query the first column (has identifier) and retrieve the data to do calculations in excel (around 55 at a time)...i.e. approx one million sims

what is the quickest method to access and query this data and spit it out in excel

Thanks
 


55 Million rows???

There's only capacity for 65,536 rows on a sheet in Excel.

???

Skip,

[glasses] [red][/red]
[tongue]
 



Code:
oRS.Open "SELECT ColumnAFieldName FROM " & strFilename & " Where SomeField='" & SomeValue & "'", oConn, 3, 1, 1


Skip,

[glasses] [red][/red]
[tongue]
 


I meant...
Code:
oRS.Open "SELECT * FROM " & strFilename & " Where ColumnAFieldName='" & SomeValue & "'", oConn, 3, 1, 1

Skip,

[glasses] [red][/red]
[tongue]
 
thanks, but it seems quicker just creating an object and reading it in vba: e.g.

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\myfile.txt", ForReading, 0)
 



1) You're only getting the first 65,536 rows. What about the other 54,934,464 rows that you never "see"???

2) the While is unnecessary since you're not doing a row-by-row traverse of your recordset
Code:
'Now actually open the text file and import into Excel
oRS.Open "SELECT * FROM " & strFilename, oConn, 3, 1, 1
[s]While Not oRS.EOF[/s]
Sheets.Add
ActiveSheet.Range("A1").CopyFromRecordset oRS, 65536
[s]Wend[/s]


Skip,

[glasses] [red][/red]
[tongue]
 
what i do currently is read line by line the text file and output the results (i.e. i built a simple query that reads the file and shoots out the data needed - around 55 rows at a time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top