PDA

Click to See Complete Forum and Search --> : A Nice One


turfbult
Aug 8th, 2000, 02:59 PM
I have two listboxes - Start Date & End Date, I want to populate these listboxes with dates ranging from today(system date) up to today, next year ie all dates from 08/08/2000 thru 08/08/2001.

Must I just get the system date and in a loop add 1 to the day, check month, check year and add each loop to the listboxes or is there an easier way!!??

JHausmann
Aug 8th, 2000, 03:10 PM
1) Use a datepicker control instead of the list box

2) dtpStart.value= date will set the first one to the current date.
3) dtpEnd.value = DateAdd("y", 1, Date) will set the end value.

You'll just need to make sure, in code that they dont select beyond the two dates...

turfbult
Aug 8th, 2000, 04:31 PM
First time I've used the datepicker - VERY NICE!!!

The only problem I'm having now is binding the datepicker to my table... here's my code..

Set DTPickerStart.DataSource = rsRecord
DTPickerStart.DataField = "start_date"

It's a MS ACCESS database and start_date is set to Date/Time. This worked fine when I was using the listbox. I also set start_date to text in the database, but I still get the error....
"runtime 545 - Unable to bind to field or datamember: start_date"

Must one do something "special" when binding the datepicker!!??

JHausmann
Aug 8th, 2000, 04:45 PM
If you have to bind the control, set it on the control itself (click on databindings).

turfbult
Aug 8th, 2000, 05:00 PM
No luck - still get the same error!!