troubleshooting Question

VB-Excel-Access TransferSpreadsheet Command

Avatar of SubodhShenvi
SubodhShenvi asked on
Visual Basic Classic
10 Comments1 Solution781 ViewsLast Modified:
   I am using TransferSpreadSheet command in VB, to transfer a excel sheet data in to a Access table. The code is as follows,

    Set oAcessApp = CreateObject("Access.Application")
    Set oDoCmd = oAcessApp.DoCmd
    oAcessApp.OpenCurrentDatabase AccessDatabasePath, True
    oDoCmd.TransferSpreadsheet TransferType:=acImport, _
        Spreadsheettype:=acSpreadsheetTypeExcel9, _
        TableName:="TempRefPhysician", _
        FileName:=ExcelFilePath, _
    Set oAcessApp = Nothing
    Set oDoCmd = Nothing

Immediately after this, I try to read the table which has been uploaded. But, the table is found to be empty. It takes some delay before data is actually inserted in the table. Thus after executing the above code, I have to put some delay loop before I can query the table uploaded. Is it that the Transferspreadsheet command runs asyncronously? and is there a wasy to avoid the delay loop? Is there a way to actually know when the TransferSpreadSheet command has finished transfering data in the table?


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros