Click to See Complete Forum and Search --> : How to best enter dates?


johnk
August 23rd, 1999, 03:11 PM
I need to allow entry of 2 or 4 digit years, with or without /s. When 2 digit years are entered, I need to display back with 4 digits, then allow change.

Would rather not use masked edit due to disimilar events exposed compared to other "standard" entry controls.


John Kisner
J.L.Kisner & Co., Inc.
Greenville, SC, USA
864-233-6941

Lothar Haensler
August 24th, 1999, 01:55 AM
VB 6 comes with several controls that support date entries such as DTPicker, a combobox that allows you to enter a date as well as select one from a drop down dialog.
There is also a MonthView control.

Get access to these controls by creating a new VB project and choose "VB EnterPrise Controls".

johnk
August 25th, 1999, 07:39 AM
Thanks, Lothar.

At your suggestion I tried out the DTPicker control and it looks like a very good one.

Our general app specs require us to also use each control for entry of search parameters in our "FIND" mode. An example: "3/22/99..5/22/99" is used for entering a range of dates.

To do this requires changing the max characters property and accepting characters invalid to date entry. I'm afraid we will have to write our own custom control, perhaps incorporating the DTPicker and a text box.

Thanks again for the tip.


John Kisner
J.L.Kisner & Co., Inc.
Greenville, SC, USA
864-233-6941

Dr_Michael
August 25th, 1999, 08:09 AM
The DTPicker.Value property returns a string with the selected date by the user. You can then use the format() to take the desired format of the date e.g. "yyyy-mm-dd". So you can with such way to take only the digits you want: If for example you like the year to be with only 2 digits: "yy-mm-dd". I don't know if I helped you, let me know... I have used the dtpicker control on databases and I have also searched the db for a space of dates. If you have problem on that ask me...

Michael Vlastos
Automation Engineer
Company Modus SA
Development Department

johnk
August 25th, 1999, 11:41 AM
Thanks very much for your helpful response. I see now that the flexibility of this control meets all of our entry needs for a single date.

I want to also provide for the entry of a range of dates when the form is used for entry of parameters used in selecting a recordset. Exp: "6/1/99..7/31/99" for use in logic which selects a recordset containing all records with dates in that range.

The only way I can see to do that is to overlay a text box when the form is used that way.

John Kisner
J.L.Kisner & Co., Inc.
Greenville, SC, USA
864-233-6941

Dr_Michael
August 26th, 1999, 01:54 AM
I don't think you need a text box. If I understood well you must use something like this:
SELECT * FROM TABLE WHERE FIELD1 >= cstr(DTPicker1.value) AND FIELD2 <= (DTPicker2.value)





Michael Vlastos
Automation Engineer
Company Modus SA
Development Department