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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When is transfer text finished?

Status
Not open for further replies.

SamirNaenenjad

Programmer
Mar 20, 2002
13
0
0
US
I have the following code to import a text file into access:

db.Execute "DELETE * FROM tblTest"

DoCmd.TransferText acImportDelim, "ImportSpec", "tblTest", "c:\Test.txt", True

The problem is that I imediately run some queries through ADO that manipulate the data, but when I open the table in a recordset I get 0 records. If I do 10K "DoEvents" before opening the table, I get the whole table.

So long story short, is there anything I can test for to see if the text import is finished, or do I just have to guess based on the file size how many loops I need to run through before manipulating the table?

Thanks in advance,
A.J.
 
I was going to post a question which is the opposite of this one: Perhaps somebody could help me with this as well. I'm using DoCMD.RunSQL to select records into a table. Then I'm using DoCmd.TransferSpreadsheet to export the contents of the table to an Excel spreadsheet. The transfer begins before the SQL statement has finished building the table. Is there a way to know when the SQL statement is completed?
Bev
 
AJ

My suggestion is to set a recordset object for tblTest and run a loop that determines the record count. If the record count property is greater than zero and it doesn't change for a few seconds I would assume the transfer has completed.

bev

My suggestion is to create an excel object, workbook object, worksheet object and range object from code and then use the copyfromrecordset method of range to transfer the recordset you create from the SQL statement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top