Date Time Picker Default dates A2000/NT

David Mack

Registered User.
Local time
Today, 01:02
Joined
Jan 4, 2000
Messages
53
I am having problems setting two date time picker controls values on the load of my. I swear this used to work in another form but gives me an error that the control value is read only. Ideas?

Private Sub Form_Load()

On Error GoTo errhandler

Me.ActiveXCtlBeginningDate.Value = Now()
Me.ActiveXCtlEndDate.Value = Now() - 30

errhandler_Exit:
Exit Sub
errhandler:
MsgBox "Error number: " & Err.Number & " Description: " & Err.Description
Resume errhandler_Exit

End Sub
 
Try using DATE instead of NOW in your code as NOW includes the Date AND Time and Date is just Date. Also, you don't have to use the () after Now or Date in the code as you are not inserting arguments and they are optional.

BL
hth
 
Thank you for your reply!

You know, I originally used the Date() function and it worked too in the original app. I was able to get things working by fully qualifying the the control (Why, I do not know).

Forms!frmDate.axBeginDate.Value = Now - 30
Forms!frmDate.axEndDate.Value = Now

Date is a better way to go.

Note for the rest of you gurus another laugh on me: My original post autographed my work with ignorance. I had the ending date before the beginning date.

I love Access progamming at the age of 46! Maybe some Ginko Bilboa will help?

And, does anyone know why if I do a "Between" statement in the criteria of a query, the activeX controls do not appear in the Expression Builder?

Cheers! And a great weekend!

Dave

[This message has been edited by David Mack (edited 05-10-2002).]
 

Users who are viewing this thread

Back
Top Bottom