Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default value for Date Picker

Status
Not open for further replies.

AmritPaulSingh

Programmer
Dec 5, 2002
46
CA
Hi guys
I amnot able to set the default date in the Date Picker.
I need Date()-1 to be the defualt value.
Any suggestions.
Thanks
 
You set the DatePicker control value in the OnLoad event of the form.

Simply refer to whatever you have named the control:

me!DatePicker1.Value = Date() -1

If this doesn't solve your problem post more details.

 
To do that, I have to turn the chek box to true. This gives me a check box next to the date picker. I don't know what its function is, but I really would not like to have it there. Is there another way?

Thanks for the response.
 
That shouldn't be. I never show the checkbox and the above code always works fine. Why do you say you have to turn the checkbox to true? What results or message are you seeing that makes you say this? I think something else is coming into play here. If you want, list your property settings for the control and I will compare them to mine.
 
I am also getting an error when using the code it saya I have an invalid property error and debug takes me to the code Me!DTPick.Value = Date



Regards

Paul
 
I am not sure where the .value comes from but for me I use Access 2000 and to set a default Date:

Me.DateField.DefaultValue = Now()

I have always have had problems with Date() function, Most of the time the function is not reconized.

If the Field is a Text Field

Me.DateField.DefaultValue = " # " Format(Now(),"dd mmm yy") & "#"

The reasion for the Format is to ensure that the Date is read properly by access. When a date Data Type is converted to a Text Data Type Access assumes a Month/Day/Year Format
(Because everybody's System Date IS in a Month/Day/Year Format!! [hammer])

But in other countries like Canada it is Day/Month/Year. Which would make the 06 Jan 03 in to 01 June 03.


Pierre
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top