Results 1 to 3 of 3
  1. #1
    etorasso is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    9

    Access 2013 Error 3011 cannot find object

    I have code that runs successfully in Access 2010 (64 bit) that does not run in Access 2013 (64 bit). It fails when attempting to open a query that exists on the database. The query shown in the screen shot below exists on the database. I can manually run the query without any issues. When I run the code shown below in Access 2010, it runs without any errors and produces the results into an Excel file. When I run the same exact same database in Access 2013 on a Windows 2012 server I get a error code 3011 when it attempts to open the same query, stating that the query cannot be found.



    Click image for larger version. 

Name:	query image.JPG 
Views:	14 
Size:	24.3 KB 
ID:	22288 Click image for larger version. 

Name:	error message.JPG 
Views:	14 
Size:	31.5 KB 
ID:	22289

    A copy of the code is shown below. The highlighted line is where the error occurs. Is there something different that needs to be done in Access 2013 vs Access 2010? Any thoughts??

    Any help would be appreciated.

    Thanks, Ed

    Code:
    Private Sub cmdExport_Click()
       On Error GoTo Err_cmdExport_Click
     
       Dim XL As Object
       Dim wbk As Object
       Dim strFolderPath As String
       Dim strAppPath As String
       Dim intOption As Integer
     
       strFolderPath = GetPath("Export")
     
       If strFolderPath = "ERROR" Then
          Exit Sub
       End If
     
       strAppPath = CurrentProject.path & "\"
     
    ' * * * CODE TO CREATE CSV FILE TO LOAD TO TEMPLATE  
       strFolderPath = strFolderPath & Me.BusinessName & " " & Format(Now, "mm-dd-yyyy") & ".xlsm"
       On Error Resume Next
       Kill strFolderPath           '***DELETE EXISTING FILE IF IT EXISTS
       On Error GoTo Err_cmdExport_Click
       DoCmd.SetWarnings False
       DoCmd.RunSQL "DELETE tmpExport_Consolidated.* FROM tmpExport_Consolidated"
       DoCmd.OpenQuery "qryBusinessExport_Consolidated", acViewNormal
       DoCmd.SetWarnings True
       
       DoCmd.TransferText acExportDelim, , "tmpExport_Consolidated", strAppPath & "custExport.csv", False, ""
       
    ' Create Formatted Spreadsheet
       Set XL = CreateObject("Excel.Application")
       XL.Workbooks.Open strAppPath & "DatabaseExport_Consolidated_Template.xlsm"
       XL.Run "Module1.ImportData"
       XL.ActiveWorkbook.SaveAs strFolderPath
       XL.Visible = True
       Set XL = Nothing
     
       MsgBox "Extract file has been created at the following directory path:" & vbCrLf & vbCrLf & strFolderPath, vbInformation, "Export Completed"
     
    Exit_cmdExport_Click:
        Exit Sub
    Err_cmdExport_Click:
        If Err.Number = 2302 Then
          MsgBox "The " & Me.BusinessName & " " & Format(Now, "mm-dd-yyyy") & ".xls file is currently opened.  Please close the file " & _
                 "in order to process this export request.", vbCritical, "File Open Error"
        Else
          MsgBox ErrorMessage(Me.Name, "cmdExport_Click") & Err.Number & " - " & Err.description, vbInformation, "System Code Error"
        End If
        Resume Exit_cmdExport_Click
    End Sub

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Does your Query Object have parameters that reference other objects? Perhaps there is corruption. You might try using .Execute rather than OpenQuery
    Currentdb.execute "qryBusinessExport_Consolidated"

  3. #3
    etorasso is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    9
    The query does reference several tables and gets input from an open form from which it is executed. I will look into that and try the execute command as suggested.

    Thanks.

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

Similar Threads

  1. Unable to Find Object Error
    By MHernan1 in forum Access
    Replies: 1
    Last Post: 08-15-2013, 04:11 PM
  2. XXXXX cannot find the object 'False.' error message
    By LindaRuble in forum Programming
    Replies: 5
    Last Post: 06-17-2013, 02:39 PM
  3. Replies: 3
    Last Post: 03-03-2013, 12:22 PM
  4. Replies: 6
    Last Post: 12-21-2012, 02:21 PM
  5. Replies: 1
    Last Post: 09-03-2011, 07:01 PM

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