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...

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.