format 1 digit year

K

Kokanutt

I have a code that names a txt file with year and julian date before export.
the naming convention includes the current year. But I only need the last
digit of the year i.e. instead of VHMC200850.txt i need VHMC850. Where "8"
is the 1 digit year and "50" is the Julian date. But i only need the 8 until
2010 then i will need the two digit year. Also when i use just "y" i get the
serial number i.e. VHMC5050. Please advise. See codes below.

DoCmd.TransferText acExportFixed, "ACR Export Specification", "Qry1",
"C:\Documents\VHCN" & Format(Now, "yy") & ((DateDiff("d", Now,
DateSerial(Year(Date), 1, 1)) - 1) * -1) & ".txt", False .......this gives
VHCN0850
 
K

Klatuu

Why have to redo the form in less than 2 years. Just use the two digit year
for all months. It will also cause your file names in Windows Explorer to
sort in the correct order, otherwise it would be like:

1
10
11
12
2
3
4
5
6
7
8
9
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Countdown macro - display settings 2
Three Digit Julian Date 5
TransferText 3
TransferTest 3
VBA Date Looping 2
Return a 3 digit number 2
Convert Claim # to Julian Dt 3
5 digit date conversion 0

Top