Results 1 to 3 of 3
  1. #1
    merebag is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2016
    Posts
    19

    Creation of #temp tables in SQL via Access VBA pass through

    I want to be able to create/drop/edit temp tables on my SQL server via access pass through vba processes. I have created select/update/delete sql queries using pass through



    Dim qdf As DAO.QueryDef, rst As DAO.RecordsetSet qdf = CurrentDb.CreateQueryDef("")
    qdf.Connect = "ODBC;DSN=XXXXXXX;Description=extday2;Trusted_Conn ection=Yes;DATABASE=XXXXXXX;AutoTranslate=No;Quote dId=No;AnsiNPW=No"
    qdf.SQL = "SELECT * FROM tblAccountMaster"
    qdf.ReturnsRecords = True
    Set rst = qdf.OpenRecordset

    This works... But when I try to do a CREATE TABLE command, I am not sure how to execute it. I know you wouldn't use an OpenRecordset for this. How would I do this via vba?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Assign the SQL to the SQL property and then

    qdf.Execute dbFailOnError + dbSeeChanges

    Edit:
    actually, you might want to double check on the arguments. Not sure what might be required for creating a table "dbSeeChanges"

  3. #3
    merebag is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2016
    Posts
    19
    That works... I didnt need the dbSeeChanges, but the creation of temp tables worked.

    Thanks again.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-20-2016, 12:44 PM
  2. temp tables
    By vicsaccess in forum Programming
    Replies: 7
    Last Post: 03-20-2016, 11:38 AM
  3. Replies: 8
    Last Post: 12-15-2014, 09:41 AM
  4. sql temp table creation for form
    By Ian_ in forum Forms
    Replies: 2
    Last Post: 06-17-2011, 03:27 AM
  5. Question About Temp Tables
    By Rawb in forum Database Design
    Replies: 4
    Last Post: 11-29-2010, 10:57 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