abc
abc

Reputation: 429

Automatically update financial year variable yearly

I have a variable that saves the start date of the current financial year which starts from 1st April as CurrentFY = #1/4/2020# in a #d/m/yyyy# format

This means that when 1st April 2021 arrives, i have to manually update this variable to CurrentFY = #1/4/2021#. Is there a way to automatically update this variable yearly?

Upvotes: 1

Views: 110

Answers (2)

Gustav
Gustav

Reputation: 55981

There is no need to "update" anything, as you can create your CurrentFY dynamically:

CurrentFY = DateSerial(Year(DateAdd("m", -3, Date)), 4, 1)

Upvotes: 1

zedfoxus
zedfoxus

Reputation: 37119

You can create a string dynamically and then convert it to date like so:

CurrentFY = CDate("1/4/" & Year(Date))

That way, any time the code runs, Year(Date) gives you year of current date.

Upvotes: 0

Related Questions