+ Reply to Thread
Results 1 to 6 of 6

Export the Query Itself? Not The Data!

  1. #1
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    214

    Export the Query Itself? Not The Data!

    Is it possible to export the query itself, not the data generated from the query?

    This is the 1st time I've looked at Access and I'm trying to figure out a systematical way of working with data generated from Excel.
    Ideally I'd have several Access tables and simply import the query into each of them and run it, but if it's only possible to generate a query from design in each database this will be quite long winded.
    Last edited by Dal123; 02-13-2018 at 08:39 AM.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    955

    Re: Export the Query Itself? Not The Data!

    yes
    vb:
    docmd.TransferDatabase acExport ,"Microsoft Access","c:\folder\dbname.mdb",acQuery ,"qsMyQuery","qsMyQuery"

    in macro:
    ImportExportData...etc

  3. #3
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    214

    Re: Export the Query Itself? Not The Data!

    Thanks ranman256,

    When I try to run the module it asks me to pick macro name, the macro isn't available to select.
    The macro has been saved and named as ExportQuery.

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 2016
    Posts
    13,179

    Re: Export the Query Itself? Not The Data!

    Please Login or Register  to view this content.
    Needs to be set up with an identification as above

  5. #5
    Forum Contributor Gregor y's Avatar
    Join Date
    10-24-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2013
    Posts
    166

    Re: Export the Query Itself? Not The Data!

    I started coding an export VBA a while back that I got working to suit my needs, and left in the ToDo's incase I needed to expand it later


    it uses a table in the ms-access database to tell it what needs exported


    ~TablesToExportSQL
    File TableName ObjectType ExportOrder
    Short Text(255) Short Text(255) Short Text(5) Number(Long Integer)
    OutFile1.sql Object Name 'Table', 'Query', 'Form', 'VBA', 'Macro' 1,2,3,4,...


    Note: use find and replace on to E in the following code.
    Please Login or Register  to view this content.
    If it'd make you feel better using my answer because of my street cred, then you can go ahead and click Add Reputation below to improve it.

  6. #6
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    214

    Re: Export the Query Itself? Not The Data!

    Thanks for the great input people, much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1