Change date format??? (1 Viewer)

NJudson

Who farted?
Local time
Today, 05:50
Joined
Feb 14, 2002
Messages
297
I'm using Access 2000 and I want work on some text files and there are hundreds of files and the one thing that all the filenames have in common is a date at the end like:

Filename 01-13-02.txt
Filename 01-14-02.txt
.
.
Filename 06-13-02.txt

I set something up like this:


Dim sdate as Date
Dim strFilename as String
Dim Output as String

For sdate = "01-13-02" to "06-13-02"

strFilename = "Filename " & sdate & ".txt"


Open Filename For Input Access Read As #1
Open Output For Output As #2

--code--

Next sdate

The problem I seem to have is that the filenames have the date format "01-13-02" and when I step through the code the value for sdate reads "1/13/02". How can I set this up so Access reads the date as "01-13-02". Thanks for any help.
 

Travis

Registered User.
Local time
Today, 02:50
Joined
Dec 17, 1999
Messages
1,332
Try: "Filename" & Format(sdate,"mm-dd-yy") & ".txt"
 

NJudson

Who farted?
Local time
Today, 05:50
Joined
Feb 14, 2002
Messages
297
Thank you very much Travis, it works great!
 

Users who are viewing this thread

Top Bottom