-
Newbie trying to find help to Copy Files
Here is my issue and remember I am very green:
I have created a database in Microsoft Access. I want to create a module that I can use to copy a .txt file from one folder to another, I want the code to seek out the current day .txt file and then copy and rename it into another folder.
Each day I receive a .txt file like so: report041807.txt, report041907.txt, and etc. for each new day.
I want to copy the file and paste it into a new folder and change the name to report.txt
I know it can be done but I am stump... Please Help!
-
When I have to code an unfamilar process, I find it helpful to break it down into individual steps, then figure out how to code each step. I would break your task down as follows:
1. Format today's date as mmddyy
a. Get today's date
b. Format as mmddyy
2. Create file name from string from Step 1
3. Copy and rename file
So, how do we do Step 1? If you Google for "vb format date", you'll see that VB has a function called Format. If you type the word "Format" in VB's code editor, highlight it, and press F1, you can read all about the Format function. One solution to Step 1 is:
sDate = Format(Date, "mmddyy")
Now, how do we create a file name that incorporates sDate?
sFileName = "report" & sDate & ".txt"
Finally, how do you copy and rename a file? Using the investigative techniques described above, look up VB's FileCopy and Name functions. ;-)
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Similar Threads
-
By dmb-job in forum VB Classic
Replies: 6
Last Post: 01-01-2007, 03:18 AM
-
Replies: 8
Last Post: 08-23-2002, 04:35 PM
-
By Karl Robinson in forum VB Classic
Replies: 7
Last Post: 07-23-2001, 10:58 AM
-
By Sinni in forum VB Classic
Replies: 0
Last Post: 07-17-2001, 12:31 PM
-
Replies: 1
Last Post: 12-12-2000, 01:03 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|