Date Time Picker

geralf

Registered User.
Local time
Today, 06:36
Joined
Nov 15, 2002
Messages
212
Hi

I'm using the activeX control Date and Time Picker which work fine. I'm having trouble though to set the MaxDate and MinDate from VBA.

For instance me.DateTimepicker12.MaxDate="01.01.2008" returns an error 'Invalid date......'.

I have tried many different formats for the date, but not the right one.

Is there someone who can shed some light on this?

Thanks in advance
 
For dates you use the # sign and not " marks:

Me.DateTimepicker12.MaxDate=#01.01.2008#
 
Hi, and thanks very much for your reply.

I'm almost certain I tried that one ( I think the compiler did not accept it). I'll try it out at work tomorrow and let you know.

Thanks again.
 
It may not like the periods as date delimiters either. You may need #01/08/2007#
 
Yes, that's correct. I know this from other date handling VBE code. I'll test it tomorrow and post back the result.

Thanks very much for your interest.
 
I have tried several but none of them works. The compiler accepts the #1/1/2008¤, but it comes up with an error message 'An invalid date was specified for the MaxDate property'.

I tried also to set it to Me.DTPicker12.MaxDate=Date with same result.

I cab read the property. and it returns the value as: 1.1.2008

Any suggestions?

Thanks.
 
Maybe it's a regional thing but I just used this code:

Me.DTPicker2.MaxDate = #1/1/2008#

and it worked great. Not sure why it wouldn't for you. I'm at a loss to explain it, unless you are missing some references maybe.
 
I have tried that as well wuthout success either. It's probably a regional setting/Access version (A2K3 Norwegian) that most likely causes this,

It's no big deal to get this to work though. It only looks much better when you can limit the date area to the actual data in the database.

You have confirmed that it works on your version of Access, so I'll leave it with that for now.

Thank you very much for your help and interest.
 

Users who are viewing this thread

Back
Top Bottom