I have a calendar on a form. I actually took it from one of of the sample calendar dbs here on the Forum.(As an aside, the sample dbs here are great. Thanks to those who take the time and trouble to write them)My question is can I put more than 1 calendar in my db-ie I have other forms that have dates for which I would like to use calendars. Can I and if so will my existing module support them or will I have to modify my existing module and/or write a new one for each calendar?
Here is the code I took from the sample db to create my module:
Option Compare Database
Option Explicit
Public Sub ShowCalendar(ByRef txtText As TextBox)
On Error GoTo Err_ErrorHandler
Dim frmCal As Form ' calendar form
Dim dteD As Control ' date control on this form
Set dteD = txtText
DoCmd.OpenForm "frmCalendar", , , , , acHidden
Set frmCal = Forms("frmCalendar")
With frmCal
Set .DateControl = dteD
.InitialDate = dteD
.Visible = True
End With
Exit_ErrorHandler:
Exit Sub
Err_ErrorHandler:
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_ErrorHandler
End Sub
Here is the code I took from the sample db to create my module:
Option Compare Database
Option Explicit
Public Sub ShowCalendar(ByRef txtText As TextBox)
On Error GoTo Err_ErrorHandler
Dim frmCal As Form ' calendar form
Dim dteD As Control ' date control on this form
Set dteD = txtText
DoCmd.OpenForm "frmCalendar", , , , , acHidden
Set frmCal = Forms("frmCalendar")
With frmCal
Set .DateControl = dteD
.InitialDate = dteD
.Visible = True
End With
Exit_ErrorHandler:
Exit Sub
Err_ErrorHandler:
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_ErrorHandler
End Sub