Results 1 to 6 of 6
  1. #1
    smoothlarryhughes is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Sep 2012
    Posts
    36

    Import SQL query into Access table

    Is is possible to import a sql query into a table within access without using a linked table / ODBC connection? In excel you can create an ODBC connection and free form SQL query into the connection so you only pull in the data you need. I am trying to import from a corporate SQL server, but there is way too much data to import everything or link the table. I'd like to include some where clauses in the import using ODBC.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    no, you link tables.
    you can import querys from other databases.
    link your table (in the query), run the query.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    you need a connection as a minimum. You can do this within a query but assuming by sql query (all queries are sql) you mean sql server you will still need a connection string. Another method is to use a stored procedure or passthrough query to return a recordset. But all depends on what exactly you are trying to do.

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Why don't you create a view in your corporate SQL server to limit the data as you need it then link/import that view into Access (both SQL tables and views can be linked/imported).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    smoothlarryhughes is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Sep 2012
    Posts
    36
    Quote Originally Posted by Gicu View Post
    Why don't you create a view in your corporate SQL server to limit the data as you need it then link/import that view into Access (both SQL tables and views can be linked/imported).

    Cheers,
    I don't have access to create a new view within sql server. I just want to use a sql query to query the specified table with certain criteria and have that import into an access table automatically. I have read access to the table, but would like to automate the process instead of running the sql query, saving the data, and importing it into access.

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Then create a pass-through query with your criteria and use a macro or VBA code to automate (run a delete query to empty your target Access table followed by an append query based on your pass-through to add the records).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Export Filtered table to Excel, Edit and Re-Import Changes to Access Table
    By Access_throwaway in forum Import/Export Data
    Replies: 15
    Last Post: 02-20-2018, 12:37 PM
  2. Replies: 1
    Last Post: 02-08-2018, 09:59 PM
  3. Replies: 3
    Last Post: 10-08-2014, 11:05 AM
  4. import table to append to a table in Access 2010
    By Stephanie53 in forum Forms
    Replies: 2
    Last Post: 05-23-2013, 03:40 PM
  5. Replies: 7
    Last Post: 05-09-2012, 06:06 AM

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