Hello Steve.
I copied iclents.dbf to bients, then added a second date field. Opened up
the calendarDemo, modify, selected listbox, used builder, selected bients.dbf,This is because you can only bind these controls to character, numeric, or null data sources. If you try to bind a combo or list box to a Date or DateTime field, Visual FoxPro will complain and display the following error at run time:
Error with
-Value: Data Type Mismatch.
Unbinding object
If you must bind a combo or list box to a Date or DateTime field, you will have to resort to a little trickery. In this case you cannot use RowSourceTypes of 2-Alias or 6-Fields. You can, for example, set the RowSourceType to 3-SQL Statement and use a SQL statement similar to this as the RowSource:SELECT DTOC( DateField ) AS DisplayDate, yada, nada, blah FROM MyTable ;
ORDER BY MyTable.DateField INTO CURSOR MyCursor
Leave the ControlSource blank and add this code to its Valid method to update the date field in the underlying table:REPLACE DateField WITH CTOD( This.Value ) IN MyTable
You will also need to write some code to manually update the control's Value from its ControlSource to mimic the behavior of a bound control when you Refresh it. This code in the combo or list box's Refresh method does the trick:This.Value = DTOC( MyTable.DateField )