format 1 digit year

  • Thread starter Thread starter Kokanutt
  • Start date Start date
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
 
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
 
Back
Top