Hi guys, im facing a problem about dtpickers. It doesnt have an option to empty date. I have an access dbase and when the query is blank date it returns an error "cant accept null values"
yeah i know that error but there's no option to empty date within DTpicker control. At first im using a textbox controls for date, but that would be difficult for the user to input date and i am oblige for a date validation procedure for that.
Is there a work around with this? I find DT picker handy for entering date but it wont allow nulls from dbase.
Im going in circles explaining... hope you dont mind...
I believe there is an option to display a checkbox on the DateTimePicker. Use this option. Set it to display and unchecked first. When a user selects a date then the checkbox gets checked automaticaly. You can use the checkbox's checked status to post either NULL or a date value into the database.
I have and example of that on the forums I'll have to search for it and post the link.
I created an app sort of a database manager with add/edit/delete/update etc.
Now when i click add record, the date field is not be required really. You can enter a date or not. In which case, the DT picker has already values on it.
I'll take you to where im gettin an error. I have a NULL value on the database date field although its datatype in access is not date but text. So when i try to query or movenext to the record with null date, it will return an error because DT picker WONT accept null values.
Use the checkbox and just don't set the date. The values in the control will be greyed out unless actually selected by the user after that and the checkbox will becom checked. If the record has a NULL date field then you set the controls checkbox to False and don't attempt to post a date there.
And this is how I use the datepicker. Today's date in a textbox. The little down arrow to its right is the datepicker control. Throughout my entire project, as well as several others before this, that is the only part of the entire control that ever appears on the screen. And, it sits right next to a textbox.