Solved

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

Posted on 2013-10-23
1
387 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
[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
1 Comment
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

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…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

617 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