Hi Ed, comments below....
I pretty much determined that I have the latest version as I looked at the
Zip. The version I got *says* it's "203" which I take to be version 2.03
Ok.
What operating system and Access version are you using by the way?
I didn't follow your suggestions to the letter setting things up-noteably
the comapctions steps. So I tried this time, deleting the modules,
compacting, and re-importing them. No go... :-(
You did not mention this, but did you compile the code?
This is MOST important!
Re-downloaded (seems to be the same file)...followed the steps...no
reference problems...still no enter key...
Did you compile?
Here's a sample of the code I'm using to call the MC:
************************************
Private Sub RecUHC_DblClick(Cancel As Integer)
Set mc = New clsMonthCal
mc.hWndForm = Me.hWnd
Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date
dtStart = Nz(Me.RecUHC.Value, 0)
dtEnd = 0
blRet = ShowMonthCalendar(mc, dtStart, dtEnd)
If blRet = True Then
Me.RecUHC = dtStart
Call RecUHC_AfterUpdate
End If
SendKeys "{TAB}"
End Sub
************************************
Pretty much a lift from your example now on Stephan's site
I'm afraid that is NOT a lift from the instructions on the web site!
These lines....:
Set mc = New clsMonthCal
mc.hWndForm = Me.hWnd
....need to be in the Form's Load event, not the procedure events.
Did you also include this code in the Declarations area of the form module (up near the top)?:
Private mc As clsMonthCal
Did you also include the Unload code?
Using one form with nothing but a text box on it with the name you provided here is ALL the code you
will need behind the form to make Stephen's calendar work. This is the bare minimum of code and this
should all be in your form's code module:
' Start of form code
Option Compare Database
Option Explicit
' This part is in the Declarations area of the form module
Private mc As clsMonthCal
Private Sub Form_Load()
Set mc = New clsMonthCal
mc.hWndForm = Me.hWnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Not mc Is Nothing Then
If mc.IsCalendar Then
Cancel = 1
Exit Sub
End If
Set mc = Nothing
End If
End Sub
Private Sub RecUHC_AfterUpdate()
' Whatever code you have going on here
End Sub
Private Sub RecUHC_DblClick(Cancel As Integer)
Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date
dtStart = Nz(Me.RecUHC.Value, 0)
dtEnd = 0
blRet = ShowMonthCalendar(mc, dtStart, dtEnd)
If blRet = True Then
Me.RecUHC = dtStart
Call RecUHC_AfterUpdate
End If
SendKeys "{TAB}"
End Sub
' End of form code
The calendar pops up and the Enter key or mouse can select a date every time in my tests.
Appreciate your reply and help. I suppose I could live with the situation,
but I really don't like having operations in my apps that can only de done
via a mouse...thanks!
We'll get it working.
Try the new code provided and then test.
If still unsuccessful please provide OS and Access version information and I'm sure Stephen will
jump in then.