Calendar Form

Kharonne

Newbie
Local time
Yesterday, 23:09
Joined
Sep 17, 2010
Messages
15
Hey I need a little help,

I have create a calendar form in my database. This calendar form is just a form with an activeX calendar object. I want to use this form with the activeX calendar object to pass dates to fields in another form. For example, in my form Projects, I have 4 date fields: "StartDate", "EstimatedClosedDate", "CloseDate", and "TerminatedDate". I would like to call my calendar form on clicking in any one of these fields, select a date, and have the date passed into the field. I do have the form working for only the "TerminatedDate" field. I cannot figure out how to get the calendar form to recognize which field to pass the date back into. Here is my code:

Calendar_Form:
Dim txtObject As TextBox

Private Sub cmdCancel_Click()
'Cancel and close form
DoCmd.Close acForm, "Calendar"

End Sub

Private Sub cmdSet_Click()
On Error GoTo ErrHandler
Set txtObject = [Form_Projects Sub].TerminatedDate
txtObject = CalObject.Value
txtObject.SetFocus


'close form
DoCmd.Close acForm, "Calendar"

CleanUpAndExit:
Exit Sub

ErrHandler:
MsgBox Err.Description
Resume CleanUpAndExit

End Sub
Private Sub Form_Load()

'This code must be placed in the Load event to work properly
'DO NOT move to the Open event
CalObject.Value = GCalDate
CalObject.Value = Date

DoCmd.RepaintObject acForm, "Calendar"

End Sub

Project_Form:

Private Sub TerminatedDate_Click()
GetDate Me.TerminatedDate
DoCmd.OpenForm "Calendar", acNormal, , , acFormAdd, acDialog

[Forms]![Calendar].SetFocus
End Sub
Private Sub StartDate_Click()
GetDate Me.TerminatedDate
DoCmd.OpenForm "Calendar", acNormal, , , acFormAdd, acDialog

[Forms]![Calendar].SetFocus
End Sub
 
Thank you for the calendar form, I could not get it to work in my database. I recieved an error message "An expression you entered is the wrong data type for one of the arguments"
 
Last edited:
hey,

I found a form online similar to the one you showed me, however, it seemed to work in my database. I don't know what the difference is, but I can post it if you would like to glance over it. Again, thank you for your help.
 

Users who are viewing this thread

Back
Top Bottom