vanhagar121
New member
- Local time
- Today, 13:51
- Joined
- Feb 22, 2013
- Messages
- 4
I am developing an access application which is used to print out transmittal cover sheets and individual transmittal forms. The data is kept on excel sheets. I am attempting to bring data into an access table using the docmd.transferSpreadsheet command. I make a copy of the sheet and I do some manipulation of the copied sheet before I import the data. I name the copied sheet sheet1 I also check the range of the sheet for the number of rows I need to import My command line with all the variables is the following
DoCmd.TransferSpreadsheet acImport, 10 , "tblDocumentDetail_Temp", True, RangeName
I use variables to define RangeName
RangeName = "Sheet1!A14:R" & Cstr(rwcurrent -1) which works out to Sheet1!A14:R583. rwcurrent is just a variable I am using to count the number of rows to import I cannot use rowcount because there are rows below the rows I need to import which would be counted using the row count command. When the command is executed I get the following error
The Microsoft Office Access database engine could not find the object 'Sheet1$A14:R583' The same error occurs when I hard code the range instead of using a variable. Any idea why this occurs if I remove the ! from the range the $ does not appear in the error message but it still cannot find the range. Any help on this would be appreciated. Thanks.
DoCmd.TransferSpreadsheet acImport, 10 , "tblDocumentDetail_Temp", True, RangeName
I use variables to define RangeName
RangeName = "Sheet1!A14:R" & Cstr(rwcurrent -1) which works out to Sheet1!A14:R583. rwcurrent is just a variable I am using to count the number of rows to import I cannot use rowcount because there are rows below the rows I need to import which would be counted using the row count command. When the command is executed I get the following error
The Microsoft Office Access database engine could not find the object 'Sheet1$A14:R583' The same error occurs when I hard code the range instead of using a variable. Any idea why this occurs if I remove the ! from the range the $ does not appear in the error message but it still cannot find the range. Any help on this would be appreciated. Thanks.
Last edited: