Results 1 to 4 of 4
  1. #1
    mcunkelman is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    2

    SQL code to create table of external data

    I used the Microsoft Query Wizard in Excel to create a query of an external SQL database. I then modified the SQL code to get everything working(rename columns, applied unit conversion factors and set relationships between the 7 separate tables I was pulling from), is it possible to reuse that SQL code from excel(Query Wizard) in Access to recreate the same table from the external database?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe you can post the SQL statement here. I understand you edited some Excel tool generated code. Beyond that, I am having difficulty understanding what the code is supposed to accomplish.

  3. #3
    mcunkelman is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    2
    SELECT table1.column1 AS 'Column_1’, table2data.column2/.3048 AS 'Column_2', table2.column3/.3048 AS 'Column_3'
    FROM database1.dbo.table2 table2, database1.dbo.table2data table2data, database1.dbo.table1 table1
    WHERE table2.idrec = table2data.idrecparent AND table2data.idcol = table1.idcol


    This is a real simple one that I made in excel that pulls data from an external source and displays a table in excel that I can sort and filter. I want to know how to recreate and modify this table in access. I know it is possible to manually add and link all the tables in access, but like I said this is a simple version, there are others querys that I would like to transfer over also that are more complex. Basically I want to know if there is a way to take the sql code I already have from excel(what I have pasted above is an example) and copy and paste it into access to just have the tables in access that I already have in excel without having to rebuild them from scratch.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    If your Access file has linked tables, that SQL should work. However, I have not tried using the fully qualified name of a table. Rather, I would use table2 or table1. Your SQL statement is using both, eg database1.dbo.table2

    Alternatively, if you want to use your SQL as a pass-through, you would need to include a connection string with your saved query object. You can do this from within the Query Designer and selecting Pass Through. The connection string would be assigned to the Query Object's properties.

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

Similar Threads

  1. Adding data to an external linked table
    By Toasty in forum Import/Export Data
    Replies: 2
    Last Post: 06-12-2014, 07:10 AM
  2. Replies: 1
    Last Post: 05-29-2013, 03:08 PM
  3. Creating a table with local and external data
    By Accessnoooob in forum Access
    Replies: 8
    Last Post: 06-25-2011, 07:36 PM
  4. Linking Access Table with already imported External Data (Excel)
    By izzarshah in forum Import/Export Data
    Replies: 1
    Last Post: 07-29-2010, 09:40 AM
  5. populate table w/ external data
    By tlittell in forum Programming
    Replies: 2
    Last Post: 02-20-2010, 08:29 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