R
ryguy7272
I have a quick question about adding an Access Calendar. I tried to follow
the example at this site:
http://www.fontstuff.com/access/acctut09.htm
This is my VBA:
Option Compare Database
Option Explicit
Dim cboOriginator As TextBox
Private Sub ConsultDate_DblClick(Cancel As Integer)
' Note which combo box called the calendar
Set cboOriginator = ConsultDate
' Unhide the calendar and give it the focus
ocxCalendar.Visible = True
ocxCalendar.SetFocus
' Match calendar date to existing date if present or today's date
If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub
Note: I am using a TextBox, not a ComboBox, as in the example. I don’t
think this is the issue, but I just wanted to throw it out there…
When I double-Click the TextBox named ConsultDate, I get a message that says
‘Compile Error: Variable not Defined’
This line of code is yellow:
Private Sub ConsultDate_DblClick(Cancel As Integer)
Please let me know what I am doing wrong.
Thanks,
Ryan---
PS, is there any way to export the Form in the example that is available for
download? I may be able to export the Form from the example at the link
mentioned above, and import it into my DB. This is VERY easy to do in Excel.
the example at this site:
http://www.fontstuff.com/access/acctut09.htm
This is my VBA:
Option Compare Database
Option Explicit
Dim cboOriginator As TextBox
Private Sub ConsultDate_DblClick(Cancel As Integer)
' Note which combo box called the calendar
Set cboOriginator = ConsultDate
' Unhide the calendar and give it the focus
ocxCalendar.Visible = True
ocxCalendar.SetFocus
' Match calendar date to existing date if present or today's date
If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub
Note: I am using a TextBox, not a ComboBox, as in the example. I don’t
think this is the issue, but I just wanted to throw it out there…
When I double-Click the TextBox named ConsultDate, I get a message that says
‘Compile Error: Variable not Defined’
This line of code is yellow:
Private Sub ConsultDate_DblClick(Cancel As Integer)
Please let me know what I am doing wrong.
Thanks,
Ryan---
PS, is there any way to export the Form in the example that is available for
download? I may be able to export the Form from the example at the link
mentioned above, and import it into my DB. This is VERY easy to do in Excel.