Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2004
    Posts
    214

    Unanswered: property not found

    All, Using Sql Server 2008 backend w/Access 2003 front end. I am running this code using pass thru qry.

    Code:
    Private Sub Command10_Click()
    On Error GoTo Err_Command10_Click
    
        Dim stDocName As String
    
        stDocName = "qrySPReports_test_passthru"
        DoCmd.OpenQuery stDocName, acNormal, acEdit
        DoCmd.OutputTo acOutputTable, "qrySPReports_test_passthru", acFormatXLSX
    Exit_Command10_Click:
        Exit Sub
    
    Err_Command10_Click:
        MsgBox Err.Description
        Resume Exit_Command10_Click
        
    End Sub
    I want this to output to excel 2010 on the users desktop. I am getting the error" property not found". It runs the query and it opens in datasheet but doesn't save to the desktop or folder as expected. The datasheet does not close. Can anyone tell me what's wrong with my code please. Thank you

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Access 2003 does not recognize the format acFormatXLSX (2010). Also, it cannot save it in the 2010 format. MS Office is not forward-compatible. It is backward-compatible, however, so you can save it in XLS format, have the user open it in Excel 2010, and re-save it.

    Sam
    Last edited by Sam Landy; 07-19-12 at 11:24. Reason: fixed typo

  3. #3
    Join Date
    Jul 2004
    Posts
    214
    Ok I'll try this. Thanks.

  4. #4
    Join Date
    Jul 2004
    Posts
    214
    Tried "xls" and it still gives me the error. When save dialog box opens, only options are excel workbook or all.
    Thanks

  5. #5
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    1. As Sam already pointed out, the OutputFormat (third) parameter should be acFormatXLS.

    2. If you want to export a query, the ObjectType (first) parameter should be acOutputQuery, not acOutputTable

    So, this should work:
    Code:
    DoCmd.OutputTo acOutputQuery, "qrySPReports_test_passthru", acFormatXLS
    Have a nice day!

  6. #6
    Join Date
    Jul 2004
    Posts
    214
    Got it. Thanks so much

  7. #7
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •