+ Reply to Thread
Results 1 to 3 of 3

Excel Table with SQL Statements to Access via VBA

  1. #1
    Registered User
    Join Date
    03-28-2010
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    60

    Excel Table with SQL Statements to Access via VBA

    Hello,

    I have an Access VBA challenge I do not know how to overcome. I have an Excel sheet with two columns, Query Name and SQL. Query Name column is obviously the name of the query I would like to create and SQL is the SQL string I would like to put into the created query. Ideally, I would like to avoid having to create a query manually and cut and paste the SQL into the SQL view of Access. I was thinking perhaps I should import this Excel sheet as a new table into Access and then somehow use VBA to loop through all the rows and create a query with the proper name based of 'Query Name' and the proper SQL based of 'SQL'. Any help would be much appreciated.

    Thank you,

    learning_vba

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Excel Table with SQL Statements to Access via VBA

    Hi,

    using ADO in excel and you can connect to a varied source of database including ms access.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Excel Table with SQL Statements to Access via VBA

    Don't know why you don't want to create the queries in Access manually where you would get help with any errors.

    But if you do want to create them in code take a look at Access' QueryDefs collection.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Import Excel table referenced in a link stored in an Access table
    By Dionysos in forum Access Tables & Databases
    Replies: 0
    Last Post: 01-16-2013, 08:09 PM
  2. How can I access Excel table from PPT
    By Mr. Structure in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2010, 04:20 PM
  3. import data from access table to excel pivot table - Enable Auto Refresh
    By okl in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-01-2010, 09:38 AM
  4. Linking an Excel table to an Access table
    By Vurna in forum Excel General
    Replies: 3
    Last Post: 07-01-2008, 10:17 AM
  5. [SOLVED] Importing data from Access to Excel, but I need to vary the table from Access
    By Liz L. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2006, 09:15 PM

Tags for this Thread

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