Access 2 Digit year in Access Text Box

Joined
Oct 19, 2017
Messages
2
Reaction score
1
Hello all,
I have a question to see if anyone can suggest anything.
I have a text unbound box that I need populated with the current Fiscal year which now for us is 2018, ok I Achieved that by doing this on the load property of the form:

Code:
Private Sub Form_Load()
If Month(Date) > 9 Then
        TxtFY = Year(Date) + 1
    Else
        TxtFY = Year(Date)
    End If
   End Sub

it populates the textbox with 2018, great!, the question is how do i get this to display only two digits aka "18".
I tried "yy" on the format but that threw my year back in time. any suggestions on how to accomplish this via VBA?
 
Last edited by a moderator:

Ian

Administrator
Joined
Feb 23, 2002
Messages
19,873
Reaction score
1,499
Welcome to PCR :).

I'm not too familiar with Access, but can you just extract the last two digits using the following instead of year(date):

Code:
Right(Year(Date), 2)
 

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

Top