0

hi, i am making an program in VB6 with access database....m inserting dates in the database at random....and want a listbox to be populated with first 3 dates starting after a particular date....
eg. input - 6 jan, 3 dec, 15 feb, 12 march, 10 dec, 7 june, 5 may

now i want first 3 dates after 10 Feb - i.e.- 15 feb, 12 March, 5 may

Please help...

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by AndreRet
0

Your sql statement as follows -

Dim strDate as Date
strDate = dtPicker>value

RS.Open "SELECT * FROM MyDatabaseName WHERE YourDateFieldName >= DateValue('" & strDate & "')"

Do While RS.EOF = False
        Listbox1.AddItem RS("TheFieldYouWantToAddName")   RS.MoveNext
Loop

This will add all the dates equal or After the date selected. If you want specific dates, add them to text box and let RS do the search and then add them to your listbox. You will use something similar as code above.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.