We help IT Professionals succeed at work.

How to get microsoft datetimepicker activex control to show blank when date field is null?

leachj
leachj asked
on
I would like to have the datetimepicker controls on my form display blank instead of the current date when the table field is null.  Is there a way to do this?

Thank's
John
Comment
Watch Question

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Look at the a Text Box property sheet. There is a property called Show Date Picker ...

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Sorry ... misread the Q.

Try Me.YourDatePickerName = Null

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Actually, are you using the Built  In Date Picker ?
Top Expert 2016

Commented:
you may have a default value set in the date/time field .

open table in design view and remove the default value on that particular field
Top Expert 2016

Commented:
see this image
defaultValue.jpg

Author

Commented:
DatabaseMX, I am using the active x control Microsoft Date and Time Picker Control 6.0 (sp4).
Capricorn1, no I don not have a default value set.  The control defaults to the current date when checkbox is unchecked.  It contains a null but displays the current date in a grayed out state.  If the checkbox is checked then the current date is written to the bound field unless a different one is selected from the built in drop down calendar.  Setting the value of the control to Null as in Me.DTPickerDOB.Value = Null,  Doesn't change the display.
Most Valuable Expert 2012
Top Expert 2013
Commented:
That particular dtPicker and it's checkbox behave exactly as you described - there is no way around it.

If you need to really 'clear out' a date/time control, you'd have to use something else.
Top Expert 2016

Commented:
you can use the built in date picker in A2007
Most Valuable Expert 2012
Top Expert 2013

Commented:
That Access 2007 DTPicker, as cap1 recommended is a much more flexible control and has an infinitely better appearance.   It is a great alternative assuming that you are actually using Access forms.

This is cross-posted to the C# zone.  What are you using to develop your user interface?
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
To be clear, what exactly do you mean when you say you want the calendar control to "show blank"

Can you post a screenshot to avoid ambiguity?

You can certainly hide the DatePicker control if the date is null...
...something like this perhaps... (If I am understanding your request)

If Isnull(me.YourDateField) then
    me.YourDatePicker.visible=False
Else
    me.YourDatePicker.visible=True
End if


JeffCoachman

Author

Commented:
I am using Access 2007.
The built in datepicker associated with the text box, does not work well for our purposes.  The reason being, we have near 50 or so date fields and most have entries of years in the past.  The built in picker is difficult to navigate beyond the current year.  You have to scroll through each month of each year.  The Active X control allows a year drop down and selection.  
I do not want to hide the  controls.  I fear mbizup is correct.

Here is image of bound control in null state.

 DatePicker Activex control in null state
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
...OK, then sorry, I misunderstood....

FWIW, you could always build your own date Picker and make it display in any way you like...
Here is one example:
http://www.fontstuff.com/access/acctut13a.htm

JeffCoachman

Author

Commented:
Please close this as there seems to be no solution.
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Then please accept mbizups post:
37240416

"This can't be done"
...is a valid solution.