Results 1 to 5 of 5
  1. #1
    Dave_D's Avatar
    Dave_D is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    67

    Runtime error 3265

    I get a runtime error 3265 - Item cannot be found in the collection corresponding to the requested name or ordinal of the following statement:



    Docmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "TRD", rst.fields("Directory_path"), True, "F:F,K:K,O:O"

    where my intentions are to import only those 3 columns.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    You are doing this in Access or Excel? I believe you cannot specify a range for exporting from Access to Excel but you can if importing in Excel. Still, I wouldn't expect that error. Perhaps more importantly, I also believe you cannot use a non contiguous range regardless.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Dave_D's Avatar
    Dave_D is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    67
    This is being done in access

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    for split ranges (assuming they are in the same sheet 'table') use a sql statement instead.

    your basic code would be something like

    Code:
    strSQL="INSERT INTO TRD (Field1, Field2, Field3)" & _
    " SELECT * FROM (SELECT Field1, Field2, Field3 FROM [sheet1$] AS xlData IN '" & rst.fields("Directory_path") & "'[Excel 12.0;HDR=yes;IMEX=0;ACCDB=Yes])  AS XL"
    currentdb.execute strSQL

    Change field and sheet names to suit.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    This is being done in access
    That leaves me with the reason being that you cannot specify non contiguous ranges. Ajax's solution would be better (as long as it works for you of course) - and simpler than automation.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 04-20-2018, 04:45 AM
  2. Create Querydef - Error 3265
    By Tim1 in forum Programming
    Replies: 3
    Last Post: 04-25-2016, 09:12 AM
  3. Run-Time Error '3265': Item Not Found In This Collection
    By Voodeux2014 in forum Programming
    Replies: 3
    Last Post: 01-29-2016, 09:04 AM
  4. Replies: 13
    Last Post: 06-12-2012, 09:52 PM
  5. Run Time Error 3265
    By duckie10 in forum Access
    Replies: 5
    Last Post: 05-13-2009, 09:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums