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!

DateTimePicker: Setting a default date

Status
Not open for further replies.

Cads

Technical User
Jan 17, 2000
40
GB
Objective: How can I successfully set the DateTimePicker on an Access form (Access 97) to a default date other than the current date?

Have come across the following in VB6 book:

DTPicker1.Month = (DTPicker1.Month Mod 12) + 1

which sets the date to one month in the future. I've adapted this approach in my Access form to:

Me.SDate_Received.Month = (Me.[SDate Received].Month Mod 12) - 2

for the date 2 months in the past I want.

Now when I ran the code, when I had the form in Design mode, it worked fine (screen appeared with date 2 months before). So far, so good. However,.... when I saved the form and ran it as part of the application, I got the message 'Run-time error 380: Invalid property value'.

Now the 'Month' property wasn't on the pick list for the ActiveX control but Access 97 seemed to accept it at Design time. So is it that I need to provide another OCX file or a reference under Tools, Reference, or....what? Any help please?

Steve House
shouse@icaew.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top