DTPIcker's Default Date

shahram

New member
Local time
Today, 00:20
Joined
Aug 28, 2005
Messages
7
Hi

I am using Microsoft ActiveX Control "DTPIcker", in my form.
However when I open my form, the default value is the value set when it was made,

Is there anyway to make it have the current date,

I read somewhere to use:

me.dtpicker.value = date()

Where should I use it
I tried it as a code for DTPIcker, but it didn’t work
And starting it on Form Load, resulted in an error, not knowing DTPIcker,

Any Help is appreciated.
 
Try following;

In design view of the form--goto property of DTPicker and type
=Now()
in Control Source of Data tab. It should work.

Ashfaque
 
Ashfaque said:
Try following;

In design view of the form--goto property of DTPicker and type
=Now()
in Control Source of Data tab. It should work.

Ashfaque

If you put Now() or Date() in the control source, you wont be able to change it.

You need to add the line from above - me.dtpicker = date() to the Forms Load event.

Dave
 
Thanx for the replies

as I said before I have already tried me.dtpicker = date() on the form load which gives my an error of compiling

Complie error
Method or data memeber not found

and it stops on ".DTPicker ="
or in case of my first code: ".DTPicker"

the other method (=Date()) worked for changing the date, but as "Oldsoftboss" said, it will not let u change it.
 
Check the name of your DatePicker. It sounds like it may be called something different on your form.
 
I just dropped one onto a form and it was named DTPicker1.

The code Me.DTPicker1 = Date worked fine.

In design view, right click on the control and select properties, then check the name.

Dave
 
Thanx alot
it worked

as everybody was using "DTPicker", I forgot that it should be the name of it.

Thanx again
 
I realize this is an old thread, but I was searching for this solution and found this article very helpful. However, to make it more clear to anyone who searches it in the future, I wanted to correct an omission above.

One must explicitly set the Value attribute of the object, not the object itself. Specifically:

me.DTPicker.Value = Date()

and NOT

me.DTPicker = Date()

I thank everyone for their replies...I was able to fix the problem as a result. I simply put the above code in for the OnLoad event for my form. Although my DTPicker object was named reportDate, so my actual line was:

me.reportDate.Value = Date()
 
Not Working for Me

When I try it I get the following error message.

DTPicker returned the following error: Property is read Only.
 

Users who are viewing this thread

Back
Top Bottom