Solved

Copy and rename linked table to local table

Posted on 2014-02-15
2
396 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

626 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