function questions

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hello All,

Does anyone know the function used to get the current year as a single
digit. i.e 2005=5 2006=6

Also I have a report that I want to add a function to it that shows the
current month being represented by a letter. Like January would be A
February would be B March would be C. Would I create a table with all
the months in one column and corresponding letters in another and have
like a lookup function or is there a different way?

Thank you,
David
 
Hello All,

Does anyone know the function used to get the current year as a single
digit. i.e 2005=5 2006=6

Also I have a report that I want to add a function to it that shows the
current month being represented by a letter. Like January would be A
February would be B March would be C. Would I create a table with all
the months in one column and corresponding letters in another and have
like a lookup function or is there a different way?

Thank you,
David

1. Right(year(MyField),1)

2: chr(month(MyField)+64)
 
Hi Andi,

Thanks for your reply. I got the first part working but I am not sure
what you mean by the second part.
 
Hi Andi,

Thanks for your reply. I got the first part working but I am not sure
what you mean by the second part.


Press F11 (you are now in VBA)
if you don't see the "immediate window" press ctrl-G

now write:
?month(date)
you get 2 , because we have February

?Chr(65)

this give you an "A", because the Ascii-code of A is 65

64 plus the month will give you what you want
 

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

Excel Vba to change displayed year automatically. 14
date format question 5
Query Question 5
Excel Excel 2010 2
John W. Vinson...continued help please 4
DAvg function w/ date criteria ? 2
IIF Statement Help 2
Calculate a year to date 6

Back
Top