Click here to Skip to main content
15,922,315 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to set Fiscal Year Like 2016-2017, 2017-2018, 2018-2019, 2019-2020 and so on.

Financial Year should be started automatic from 1st April of every year and end on 31st March of every year.

When New Financial Year Starts all data of last financial years should be invisible and refresh all category in data base.

for Example:
if we will select last financial year 2016-2017 from Combo Box then all data should be shown from 1st April 2016 to 31st March 2017 only and like this.

please help.

What I have tried:

i dont know how to make this possible. Please help me to complete my project
Updated 29-May-17 7:49am
Richard MacCutchan 29-May-17 13:38pm    
Since you have not given any clue where in your code you are trying to do this, it is impossible to help you. Somewhere in your code you need to set a value which tells you which year to start at.

1 solution

Dim selectedYear As String = ComboBox1.SelectedValue '"2016-2017"
Dim initialYear As Integer = CInt(selectedYear.Substring(0, 4))
Dim fiscalYearStart As Date = New DateTime(initialYear, 4,1)
Dim fiscalYearEnd As Date = fiscalYearStart.AddYears(1).AddDays(-1)

Now, when you've got initiated both variables, you have to create parameterized query[^] to your database:
Dim qry As String = "SELECT <set_of_columns>" & vbCr & _ 
"FROM YourTable" & vbCr & _
"WHERE SomeDate>=@fys AND SomeDate>=@fye"

How to execute it? Depending on database type, you have to use proper .net framework data provider[^].

If your database is located on MS SQL Server, check this: SqlCommand.Parameters Property (System.Data.SqlClient)[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900