Answer for:

How do I automate generation of a Date Code from =Date() in MS-Access 2007?

Message 2 of 2

View entire thread
0 Votes
Tony Hopkinson

you could do it with a calculated field, it's jus a big bunch of vb (or sql functions)
So if the date you are building the code from is TransactionDate

Year(TransactionDate) = 2012
2012 - 2011 = 1
A is ascii 65
B is chr(65 + 1)

Ad nauseum.
So in VB it's Year, Month and Day (I think), In SQL it's DatePart for the parts of your date
Chr in SQl would be a convert(Char,SomeValue)