Topic: Null Dates On Forms

Is there anyway to show datetimepicker fields as blank on forms when they are null? MVD always defaults to today's date even when it is unchecked. It's very confusing to people to see a date in there when it is suppose to be empty even though it is grayed out.  Also, I have not found a way to check for null dates on forms. In order to actually see if a date is null one has to do a SQLExecute and select the date field from the table. It just seems to be an extra unnecessary seek to the database to check for null dates. Please direct me in the right direction if I am wrong. Thank you.

Re: Null Dates On Forms

Good Evening EHWagner,
Agreed - it can be confusing about the dates and times, even though greyed out.  Attached is the way I get around it, if it's any help to you.
Derek.

Post's attachments

Attachment icon confusing dates.zip 335.82 kb, 465 downloads since 2016-02-14 

Re: Null Dates On Forms

You can use this hack, example you have form frmAbonent to create/edit records and this form have DateTimePicker1 component:

procedure frmAbonent_OnShow (Sender: string; Action: string);
begin
    if frmAbonent.DateTimePicker1.Checked then frmAbonent.DateTimePicker1.Format := ''
    else frmAbonent.DateTimePicker1.Format := ' ';
end;

procedure frmAbonent_DateTimePicker1_OnChange (Sender: string);
begin
    if frmAbonent.DateTimePicker1.Checked then frmAbonent.DateTimePicker1.Format := ''
    else frmAbonent.DateTimePicker1.Format := ' ';
end;
Dmitry.

Re: Null Dates On Forms

Derek - Thank you for your workaround trickery. That was very ingenious on your part.

Dimitry - Thanks for your hack. Any plans to incorporate it in MVD?

Re: Null Dates On Forms

ehwagner wrote:

Dimitry - Thanks for your hack. Any plans to incorporate it in MVD?

Unfortunately no, this non-standard behavior of the component.

Dmitry.