Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do you change the Name of a table when you change to a excel table?

Posted on 2013-10-23
1
Medium Priority
?
395 Views
Last Modified: 2013-10-23
I am transferring a table to excel format and then it goes to a folder on the c drive.
How do I automatically change the name of the excel spreadsheet once it is converted to excel?

Dim strTable1Name1        As String
Dim strBasePath             As String

strBasePath = "C:\InductionImport\"
strTable1Name1 = strBasePath & "tblFS3ResponsesSelected.xlsx"

DoCmd.TransferSpreadsheet acExport, , "tblFS3ResponsesSelected", strTable1Name1
MsgBox "Export Complete, Data is Now in InductionImport Folder!"

DoCmd.OpenQuery "qryDeletetblFS3ResponsesSelectedFromMain", acViewNormal, acEdit
MsgBox "Records Have Been deleted from Main table in Database!"

DoCmd.OpenQuery "qryDeletetblFS3ResponsesSelected", acViewNormal, acEdit
MsgBox "Records Have Been deleted from tblFS3ResponsesSelected!"
MsgBox "Select Record to Export !"
0
Comment
Question by:gigifarrow
1 Comment
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 39595037
you can change the name from this string

strTable1Name1 = strBasePath & "tblFS3ResponsesSelected.xlsx"

example

strTable1Name1 = strBasePath & "NewExcelName.xlsx"


or

strBasePath = "C:\InductionImport\"
strTable1Name1 = strBasePath & "tblFS3ResponsesSelected.xlsx"

after the export commands


if dir(strTable1Name1)<>"" then

name strTable1Name1 as strBasePath & "Newname.xlsx"

end if
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

824 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