Topic: Date field to read 00/00/0000

Hi all,
I have a question about the date field.
When I'm creating a new record, my date field shows 06/06/2022 (today's date)
.
I would like it to show 00/00/0000 before I try to put anything in it.
Then I would like to click on any part of the date and change it.  ex 04/05/2010 like I can do when the default date is there.
.
If I blank the date using frmService.cboSvcDate.Format := ' ' ; it does make the date BLANK.  Then I have to choose a date using the date box.  I would really like the default date to show 00/00/0000 and then be able to click on each part of the date to put in what I want.
.
Thanks
Frank

Re: Date field to read 00/00/0000

Hi Frank,

You can not be able to set 00-00-0000 since the minimum date cannot be
earlier than 01-01-1601 in DateTimePicker and Calendar.

Use a different date, such as 01-01-1900 or 01-01-2000 if these dates will not be entered as data.

Re: Date field to read 00/00/0000

Sparrow,
Thanks for the feedback.  Now I understand why 00/00/0000 can not be used.
.
My logic for wanting it to be 00/00/0000 is because I wanted it to be more obvious to the user that they need to input a new date for the field.  In some cases it could be appropriate for them to use today's date.  However in other cases they might need to put in a different date.  If they're not paying attention, then they could accidently accept the default date - today's date. Over the years I've seen many instances where people make mistakes, unless it's very obvious of what they should do.
.
I've been experimenting with a Text field to hold a date with a mask of __/__/____ So when they see a blank field with this format then it would be more obvious that it needs to be filled with data.  So far it's working but I haven't tried to incorporate it into my application. I know I'll have to convert it to a true Date field at some point, but I think I know how to do that.
.
I know I'm being fussy, however if you have any thoughts about how I might be able to reach my goal of a blank date field please let me know.
.
Because of the outstanding support from yourself and others on the Forum, I'm able to do so many more things by myself.  Thank you so much.
.
Frank

Re: Date field to read 00/00/0000

I am glad that you experiment and achieve results.
I had a question, do you need a calendar, while answering your question.
If not, then you can try three TEXTBOX (day, month, year) separately.
You can change their appearance for better readability and decorate/separate
them with "/". In each of them, you can display 00 or 0000 at startup.
There will be a little problem with processing and writing the date to the database.
But this is solvable. )))
But it facilitates the process of checking textboxes for filling and avoiding masks in the text field.

Re: Date field to read 00/00/0000

Sparrow,

I don't really need a calendar. The Date field is nice and has a lot of bells and whistles, but I find when I'm  in a date field it seems to be easiest to just type in the date - like 06/22/2001.  If the default date could be set to __/__/____ then I think it would be nice. And simple.  But I couldn't find any way to set it like this?
.
I'll play around some more with my Date Text box & see how it goes.
.
Thanks
Frank

Re: Date field to read 00/00/0000

Hi Frank, Hi Sparrow,
Could you do it something like the attached?  It means you're not having to mess around changing text fields to datetimepickers and vice versa, plus it keeps the script nice and compact.
I've used 00/00/0000 but you can easily change it to __/__/____
Derek.

Post's attachments

Attachment icon zero date display.zip 337.3 kb, 151 downloads since 2022-06-08 

Re: Date field to read 00/00/0000

Hi Derek,
I see what you're doing and it does work.....but there's always a but smile
.
What I think would be nice is when the new date field is visible it would show __/__/____
And then I would be able to put the mm/dd/yyyy in each part of the date field, without having to use the calendar and go through a lot of steps.
.
However it looks to me like the Datepicker field just doesn't work that way.
.
However thanks to your example code I found a solution that I believe is the closest to what I was looking for.
For a New Record
- I use your panel over the DATE portion of the field and I leave the check box visible
- So when you open the form the date field appears empty
- Then when I click the date field check box I make the panel go away, thus exposing the rest of the date field
- It does show today's date but at least the user is focused on the date field and should be more inclined to put in the date they want
- I can then change the date by either clicking on the individual elements or use the calendar drop down function.
.
Then if I'm editing a record that already has a date in the Date field, I check to see if the box has been checked and if yes, then I remove the cover up panel.
.
It's a pretty neat solution
Thanks
Frank

Re: Date field to read 00/00/0000

Hi Frank,
Probably the easiest way is to go 'old school' and just ask the user to confirm at the time of saving if a date of 'today' is correct or not? (see attached).
Derek.

Post's attachments

Attachment icon zero date display2.zip 337.77 kb, 153 downloads since 2022-06-08 

Re: Date field to read 00/00/0000

Hi folks,

Thank you for these experiments.  Sometimes I have preference issues with the Datepicker too.  This gives me some more options big_smile

-joshuA

"Energy and persistence conquer all things."