473,395 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Renaming .xlsx File in Folder Location using Variable

11
Windows 7, Access 2010 32-bit

I have exported a file to the following path and name:
h:\main\test\todaysdatafile_currdata.xlsx

Once exported, I am trying to rename it as follows (using the NAME command):
h:\main\test\mapfile_mmddyy.xlsx where the mmddyy reads a control field on the form that is equivalent to the current date in the mmddyy format.

I get everything in my results but the mmddyy variable.

Any suggestions?

Kindest regards,
A12help
Nov 7 '12 #1

✓ answered by NeoPa

Try :
Expand|Select|Wrap|Line Numbers
  1. Name "h:\main\test\todaysdatafile_currdata.xlsx" As _
  2.      "mapfile_" & Format(Date(), "mmddyy") & ".xlsx"
Todays date is always available from the Date() function but it should be formatted explicitly if you want to be sure of it coming out in the right way.

5 2383
zmbd
5,501 Expert Mod 4TB
A12... as in your other post... we need to see your code.
Please format it using the <CODE/> button once posted.
Nov 7 '12 #2
A12help
11
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSavedImportExport "Exp_SF Map File"
  2. Name "h:\main\test\todaysdatafile_currdata.xlsx" As "h:\main\test\mapfile_mmddyy_" & ctlFileDt & ".xlsx"
Nov 7 '12 #3
NeoPa
32,556 Expert Mod 16PB
Try :
Expand|Select|Wrap|Line Numbers
  1. Name "h:\main\test\todaysdatafile_currdata.xlsx" As _
  2.      "mapfile_" & Format(Date(), "mmddyy") & ".xlsx"
Todays date is always available from the Date() function but it should be formatted explicitly if you want to be sure of it coming out in the right way.
Nov 7 '12 #4
A12help
11
NeoPa,

Thanks so much; I knew it would be something simple.

When I created the ctlFileDt field on the form, I did all of the date formatting there thinking the code could just read that field. I did not think about dumping the formatting piece directly into the code. I tried and this works great.

Sincerely appreciate the help.
Nov 7 '12 #5
NeoPa
32,556 Expert Mod 16PB
Not a problem. It's good to be able to help :-)
Nov 7 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Joe | last post by:
How can I rename a folder that has the same name, but with different character casing? When I do either of the following, I get an error saying "Source and destination path must be different.": ...
11
by: Mr. B | last post by:
If you can set the 'initial' path of an OpenFileDialog box by something like the following: Dim FilesPath As String ' Files Path FilesPath = "P:\Projects\" FilesPath =...
0
by: Alphonse Giambrone | last post by:
I am building an asp.net web app where a couple of pages will use ssl. It is on a commercial shared host and will utilize a shared ssl certificate. The SSL folder provided is physically on the same...
0
by: Alek Davis | last post by:
Is there a way to determine a path to the log file folder from an HTTP context? I am trying to implement a logging capability for an app and would like to have a default location in case the caller...
3
by: The Woo | last post by:
Can one programatically create a file folder which has the same name as a key field, using a command button? Or, Can there be a a command button which opens up a directory tree to a specified...
4
by: petedawn | last post by:
guys, how do i check if the folder location the user is entering ends with a \. and if it does not show and error and if does end with a \ process the form. thanks.
1
by: pake2007 | last post by:
How Do I make a File-Folder autoback in Windows XP??? I just want the computer to backup every night some files and folder from one location to another. Please if you know how give me the step by...
4
by: dillneus | last post by:
Hey I must do the News Storage database. It sounds pretty easy but there is one point I don't know how to do. When I download the news file and save it in .pdf. I have database that records all...
1
by: thom21 | last post by:
hi, I'm having trouble figuring out exactly how to solve the following problem: I have an xml document "doc1.xml" that needs to be renamed and then moved to a new folder directory...
0
by: user1980 | last post by:
hello.. i am developing a page in asp to open an .xlsx file and display its contents.. i have used this connection string sConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.