Solved

Copy and rename linked table to local table

Posted on 2014-02-15
2
376 Views
Last Modified: 2014-02-15
Hello~ I found the following code that very nicely copies and prompts the end user to enter a date that is included in the copied table's name. Because I am not familiar with VBA, can anyone assist in amending the following so that it will copy and prompt the end user for a date to be concatenated with the table name but for a linked table to a local table:

Dim strOldTable As String
Dim strPrompt As String

strPrompt = InputBox("Enter date table is copied")
DoCmd.CopyObject , "Test Table" & "_" & strPrompt, acTable, "Test Table"

The result is "Test Table_2/15/14" (or whatever date the end user enters).  Any help is great appreciated.
0
Comment
Question by:jaguar5554
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39861997
your code looks ok.
are you getting any problem, error?


here is an alternative code, using create a new table

Dim strOldTable As String, strNewtable
Dim strPrompt As String
strOldTable = "Test Table"
strPrompt = InputBox("Enter date table is copied")
strNewtable = strOldTable & "_" & strPrompt

CurrentDb.Execute "Select [" & strOldTable & "].* INTO [" & strNewtable & "]" _
        & " From [" & strOldTable & "]"
0
 

Author Closing Comment

by:jaguar5554
ID: 39862051
That works beautifully! To answer yours -- the original code worked fine; however, it created another linked file. Your code copies the linked table to a local table -- along with a prompt to rename/date the copy. That's just what I needed. Thank you much!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Balance after Repayment - 2 6 62
Menus 6 58
Add Underline to custom Caption on Label 4 36
Export individual report to pdf 2 41
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question