Results 1 to 6 of 6
  1. #1
    DTO. is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    48

    Excelexport query - macro is not working with SQL Linked Table

    Dear Friends,

    I am using Linked table in MS Access from BE SQL Server. Forms and my reports are working with my queries from FE Side
    But the only problem is the excel export query is not working together with Export macro. But I went to directly to look at the query itself if it is running.
    And I saw those Excelexport queries which my export macro uses, is also working themselves alone



    (Some additional informations - My linked table connection is done with SQL Server Driver and File DSN
    I did all indexing PKs, and also relations in SQL Server side)

    The same query is not working together with exportmacro. What is the solution. I will be appreciated.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you didnt provide any code from the macro.

    I too have SQL backend. excel exports perfectly.
    maybe try using code:

    vFile = "c:\temp\ExportResults.xls"
    sTabName = "results1"
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qsData2Export", vFile, True, sTabName


    but it should work in the macro too.

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,158
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    DTO. is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    48
    Quote Originally Posted by ranman256 View Post
    you didnt provide any code from the macro.

    I too have SQL backend. excel exports perfectly.
    maybe try using code:

    vFile = "c:\temp\ExportResults.xls"
    sTabName = "results1"
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qsData2Export", vFile, True, sTabName


    but it should work in the macro too.

    Hello Ranman,

    Thanks but I do not have code to share. It is a macro. I choosed the conditionally export as excel file. And I choosed my query to export.
    But it does not work.

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    macro IS code
    cant help w/o code.

  6. #6
    DTO. is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    48
    Hello Ranman256,

    TransferSpreadsheet method has worked. I did not get why macro is not working when queries are based on Linked Table of SQL Server.
    Maybe export macro of Access is not competible with SQL Server.

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

Similar Threads

  1. Linked table working only for items that are equal
    By damngroundhog in forum Access
    Replies: 3
    Last Post: 09-23-2019, 09:54 AM
  2. Replies: 2
    Last Post: 04-15-2014, 10:03 PM
  3. Replies: 1
    Last Post: 09-11-2012, 10:31 PM
  4. linked table refresh in 2010 not working in 2000
    By bbbeng in forum Import/Export Data
    Replies: 3
    Last Post: 12-20-2011, 01:25 PM
  5. linked table long query not working
    By mirthcyy in forum Queries
    Replies: 4
    Last Post: 09-23-2010, 03:16 PM

Tags for this Thread

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