officemanager2
Technical User
Came across Allen Browne's site and it is great. I've gotten a calender function from the site and can incorporate it into my form as it appears from Browne's site just fine.
The code is set up that one pushes a button the calender opens, date is selected and entered into a field.
The issue is I don't want the calender to have to launch from a button, I would rather the calender always be present on the form instead of being a subform.
I've tried to cut and paste the calender right on to the form but cannot get it to work from there because it seems that the launch button must be pushed (clicked) to get it to work.
VBA to open the calender form:
Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
'On Error GoTo Err_Handler
'Purpose: Open the calendar form, identifying the text box to return the date to.
'Arguments: txt = the text box to return the date to.
' strTitle = the caption for the calendar form (passed in OpenArgs).
Set gtxtCalTarget = txt
DoCmd.OpenForm "frmCalendar", windowmode:=acDialog, OpenArgs:=strTitle
Exit_Handler:
Exit Function
Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, vbExclamation, "CalendarFor()"
Resume Exit_Handler
End Function
Any Suggestions?
The code is set up that one pushes a button the calender opens, date is selected and entered into a field.
The issue is I don't want the calender to have to launch from a button, I would rather the calender always be present on the form instead of being a subform.
I've tried to cut and paste the calender right on to the form but cannot get it to work from there because it seems that the launch button must be pushed (clicked) to get it to work.
VBA to open the calender form:
Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
'On Error GoTo Err_Handler
'Purpose: Open the calendar form, identifying the text box to return the date to.
'Arguments: txt = the text box to return the date to.
' strTitle = the caption for the calendar form (passed in OpenArgs).
Set gtxtCalTarget = txt
DoCmd.OpenForm "frmCalendar", windowmode:=acDialog, OpenArgs:=strTitle
Exit_Handler:
Exit Function
Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, vbExclamation, "CalendarFor()"
Resume Exit_Handler
End Function
Any Suggestions?