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

TransferSpreadsheet error

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
Using Access 2007
I am trying to use a command button on a form to transfer data from a spreadsheet into an Access table.

The table has the following relevant fields:
Code:
RecordID (autoNumber), EnvNbr, Local, M and S, Building, Memorial, Other, Date Given, InMemoryOf, ToFund

The Excel 2007 sheet has the following fields:
Code:
RecordID (blank),	EnvNbr, Local, M and S, Building, Memorial, Other, Date Given, InMemoryOf, ToFund, Total

Here is the code behind the command button:
Code:
DoCmd.TransferSpreadsheet acImport, 9, "tblNewGivings", "C:\Users\Tom Watson\Desktop\counter_sheet.xls", True, "A2:J2"

When I try to execute the command button, I get error 3673 "This table contains cells that are outside the range contained in the spreadsheet."

Any tips on how to fix this?

Thanks.

Tom
 
Perhaps it's useful to explain a bit more about what this is for.

It's a database that keeps track of weekly contributions to a church. The counters will enter data in an Excel spreadsheet. From there the data will be brought in and added to an existing tblNewGivings.

Maybe there's a better way to accomplish this than the TransferSpreadsheet method. Copy and Paste could be used, but I was trying to automate it a bit more than that.

Tom
 
I figured out where the problem lies.

The spreadsheet has tabs, so Access can't find the cell range specified.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top