View Full Version : CALANDER IN FORM


despino
12-12-2001, 06:12 AM
I HAVE A CALANDER CONTROL 9.0 ON A FORM AND WISH TO HAVE IT LKINKED TO DATE FEILD ON THE FORM. IS IT POSSIBLE TO CONFIGURE THE CONTROL TO WHERE YOU CLICK ON A DATE IN THE CALANDER THE DATE APPEARS IN THE FEILD? ALSO I CANT FIGURE OUT HOW TO GET THE CALANDER TO START AT TODAYS DATE WHEN THE FORM OPENS UP. IT DEFAULTS TO DATE IT WAS CREATED. ANY HELP IS APPRECIATED..

Jack Cowley
12-12-2001, 07:14 AM
Assuming your Calender is named Calendar then "Me![Calendar].Value = Date" will set the date.

The Calendar control does not contain an On Click Event so you need to create your own. Code like this should do it:

Private Sub Calendar_Click()

On Error GoTo Calendar_Click_Error

[YourTextField].Value = [Calendar].Value

Calendar_Click_Exit:
Exit Sub

Calendar_Click_Error:
MsgBox Err.Description
Resume Calendar_Click_Exit

End Sub

despino
12-12-2001, 07:48 AM
one more thing...how do i get the form to open up to the last record entered???
thanks for all the help

Jack Cowley
12-12-2001, 12:27 PM
In the forms On Open event put this in the Event Procedure:

DoCmd.GoToRecord , , acLast

This will show the last record but that may NOT be the last record entered.

[This message has been edited by Jack Cowley (edited 12-12-2001).]

despino
12-12-2001, 01:02 PM
I ACCOMPLISHED THIS BY CREATING A MACRO (GOTO RECORD - LAST) AND PUTTING IT IN THE "ON LOAD" FIELD IN PROPERTIES.....THANKS FOR ALL THE HELP