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
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