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

Problems with DoCmd.TransferSpreadsheet function

Status
Not open for further replies.

irethedo

Technical User
Feb 8, 2005
429
US
I am using a DoCmd.TransferSpreadsheet function to copy a spreadsheet into an Access table which was working fine
(creating a 276 record table from a 276 line spreadsheet), but now it is taking a 276 line spreadsheet and creating a table with 14652 records.

I am told that this is an excel 2007 format and the command that I am using is:

Code:
  DoCmd.TransferSpreadsheet acImport, 8, "NewData_tbl", In_File, True

Not sure what changed. How can I correct this?

Thanks
 
Ok, I changed this to a type 9 for the Excel 2007 format :

Code:
    DoCmd.TransferSpreadsheet acImport, 9, "NewData_tbl", In_File, True

And then added the following:

Code:
    strSql = "Delete * FROM NewData_tbl"
    CurrentDb.Execute strSql

before the DoCmd.TreansferSpreadsheet function which clears out the data in the table,
and all is well

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top