Results 1 to 2 of 2
  1. #1
    rwharris is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    1

    Problem With Make-Table Query


    I am new to Access, the 2007 version. In my current project, I would like to be able to make a copy of a table. This can, of course be done with copy-and-paste but I would like to automate the process. I had the idea of using a Make-Table query in which all records are selected from the source table and copied to the destination table. The problem is that, insofar as I can see, the destination table name is "hard-coded" within the query. My project is going to require making a copy of the table on a daily basis. I would like for the project to prompt for a destination table name before making the table. I can't figure out how to do this. I thought about the use of TempVar but I can't figure out how it would work. Any suggestions would be qreatly appreciated.

    Robert Harris

  2. #2
    jrickels is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2009
    Posts
    5
    You could prompt the user in vba:

    Public Sub CopyTable()
    Dim answer As String
    Dim sql As String
    answer = InputBox("What would you like to name your table?", "Table Name")
    sql = "SELECT OriginalTable.* INTO " & answer & " FROM OriginalTable"
    DoCmd.RunSQL sql
    End Sub

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

Similar Threads

  1. Change Path of Make Table Query
    By Arnie49 in forum Access
    Replies: 0
    Last Post: 03-14-2010, 05:29 PM
  2. Make table query
    By Zahed in forum Queries
    Replies: 1
    Last Post: 11-06-2009, 05:44 AM
  3. Replies: 2
    Last Post: 10-27-2009, 07:09 AM
  4. Make Table Query Issue
    By tmcrouse in forum Access
    Replies: 0
    Last Post: 07-23-2009, 03:20 PM
  5. Make a table query
    By Fiona in forum Access
    Replies: 4
    Last Post: 06-25-2009, 11:24 AM

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