(EXCEL)VBA Spin button which steps through in an sql databases date time

Posted by Gulredy on Stack Overflow See other posts from Stack Overflow or by Gulredy
Published on 2012-08-29T09:37:05Z Indexed on 2012/08/29 9:38 UTC
Read the original article Hit count: 368

Filed under:
|

I have an sql Database table in MySQL which have lots of rows with varied date time values. For example:

2012-08-21 10:10:00   <-- with these date there are around 12 rows
2012-08-21 15:31:00   <-- with these date there are around 5  rows
2012-08-22 11:40:00   <-- with these date there are around 10 rows
2012-08-22 12:17:00   <-- with these date there are around 9  rows
2012-08-22 12:18:00   <-- with these date there are around 7  rows
2012-08-25 07:21:00   <-- with these date there are around 6  rows

If the user clicks on the SpinButton1_SpinUp() or SpinButton1_SpinDown() button then it should do the following:

The SpinButton1_SpinUp() button should filter out those data from an sql table which is the next after what we are currently on now. Example: We have currently selected: 2012-08-21 15:31:00. The user hits the SpinUp button then the program selects those date from the database, which is the next higher value like this one: 2012-08-22 11:40:00. So the user hits the SpinUp button the data which is selected in the database will change from those with date: 2012-08-21 15:31:00 to those with date: 2012-08-22 11:40:00

The SpinButton1_SpinDown() will do exactly the reverse of the SpinUp button. When the user hits the SpinDown button the data which is selected in the database will change from those with date: 2012-08-21 15:31:00 to those with date 2012-08-21 10:10:00

So I think the date which we are currently on, should be stored in a variable. But on button hit not every bigger or lower data should be selected in the database, only those which are the closest bigger or the closest lower date.

How can I do this?

I hope I described my problem understandable. My native language is not english, so misunderstandings can occur! Please ask if you don't understand something! Thank you for reading!

© Stack Overflow or respective owner

Related posts about mysql

Related posts about excel-vba