Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am making a database software
front end is vb 6.0
back end is msaccess
one module is to display statistical data:
there will be a combo box n a command button
where user can select year from a combo box n then can click on command button to generate a graph month wise of the year selected in the above combo box.
my queries are as follows:
1. at form load i need to get distinct year from database. (as we cannot give hard coded years value in database)
how to get it?
2. when user select a particular year then how to get data entries related to that particular year and further how to sort them into 12 different months.
e.g if the user is using s/w since 2008 then it in combo box entry should be
2008
2009
2010
2011
(my query no 1 is how to get this distinct year entries from database)
when user select year say 2009 then when it click on command button it here graph is shown month wise of that particular year
so now how to fetch data year wise n then sort it month wise like
january of 2009
february of 2009
march of 2009
..
...
Thnks.
Posted
Comments
Christian Graus 21-Jun-11 4:08am    
Why are so many people using VB6 in 2011 ? Is it self loathing ?
Sergey Alexandrovich Kryukov 21-Jun-11 4:22am    
Exactly. Amazing... or sad.
--SA
Sergey Alexandrovich Kryukov 21-Jun-11 4:27am    
On second thought... why in 2011? VB was apparent complete crap in 1991 and remained crap in 1998 (VB6), it was clear in first place. I never knew a single software engineer who ever considered using it. (Well, I don't call software engineers everyone who write some code...)
--SA
CPallini 21-Jun-11 4:35am    
I don't think so and I know clever people who used and appreciated it. However I think it is outdated and there are far better alternatives these days.
Sergey Alexandrovich Kryukov 22-Jun-11 17:36pm    
Well, you did and I did not -- difference experience, no more. "Clever" is not 100% relevant, a clever person can make a mistake.
--SA

1 solution

1. You should use a query to retrieve all the years of the records stored inside the database, for instance "SELECT DISTINCT YEAR FROM MyTable'

2. When the user selects a year then you have just to prompt the list of the 12 months (you know such list doesn't change with years...).
 
Share this answer
 
v2

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