Results 1 to 7 of 7
  1. #1
    wikky is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    3

    How to export queries in Access 2007 to text files

    I have a ton of queries for a database in Access 2007 and I need to export all of them to text files. I have searched everywhere and haven't found a solution intuitive enough.



    I tried going to the 'External Data' tab and then choosing 'Text File', but it tries to output the result set and not the actual query itself. HELP!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you looked at the undocumented "SaveAsText" function? It sounds like you want the SQL view saved as a Text file.

  3. #3
    Join Date
    May 2010
    Posts
    339
    Have you tried to right click on the query? You can right click on your query and export it to the desktop as a pdf or TXT.

  4. #4
    wikky is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    3
    I haven't tried the SaveAsText function and I can'tright-click and save the file as PDF or text because I do not want the query results. I would like the queries themselves. Preferably to exported to SQL files if possible since these will be imported into a SQL Server database. Thanks

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    In either a Standard module or the immediate window:
    Application.SaveAsText(ObjectType AS acObjectType, ObjectName As String, FileName As String)

    LoadFromText is identical in its parameters. For example:

    Application.SaveAsText(acForm,"frmMyForm","H:\Clie ntX\frmMyForm.txt")

  6. #6
    wikky is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    3
    RuralGuy--I am sort of a noob to advanced features in Access. If you could elaborate/break down the steps to accomplish that, then I would greatly appreciate it. Thank you

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I just tested it on a query and it will not do what it sounds like you need anyway. I'll keep looking for a solution.

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

Similar Threads

  1. Import Text Files without access
    By 95DSM in forum Import/Export Data
    Replies: 1
    Last Post: 09-10-2010, 04:36 PM
  2. Export 2 Queries to Same Workbook in Access 2010
    By Mikey in forum Import/Export Data
    Replies: 2
    Last Post: 08-23-2010, 05:16 AM
  3. Field returns error when I import Text Files to Access
    By geng in forum Import/Export Data
    Replies: 3
    Last Post: 06-01-2010, 02:20 PM
  4. Export Query to Various Excel Files
    By dalet in forum Import/Export Data
    Replies: 7
    Last Post: 11-09-2009, 09:22 AM
  5. Upload files to access 2007 through web
    By karthikcoep in forum Programming
    Replies: 0
    Last Post: 08-23-2009, 10:04 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