Calendar - datetime picker

B

BillEchert

Hi, I am using the ActiveX Calendar control that comes with Access 2002.

I have a calendar control bound to the recordsource on a form. I have
enabled the check box. The date is not required so the associated report
will display a blank date. If a user wishes to enter a date they click the
calendar control's checkbox and select a date.

The issue is that the default month and year that displays when the checkbox
is clicked is the value when the control was created which is a date in the
past which requires the user to navigate through the month and year dropdowns
to get to the current date.

If I set the control's date value at the time of form load the control is
enabled. I don't want the control enabled until the user clicks the
checkbox.

Is there a way to set the date in the load event but not have the control
enabled or can the date be set when the checkbox is clicked?

Thanks for your help.

Bill
 
L

Linq Adams via AccessMonster.com

I think the first question most people are going to ask is why would you
force your user to click on a checkbox before using the calendar?

The standard way of setting the date is at Form Load, which is normally not a
problem because, to be honest, no one I've ever heard from disables the
calendar! But if you're going to use the checkbox, then use it to
enable/disable the calendar and to set the default date on the calendar. This
assumes that the calendar is disabled either in the properties box or in Form
Load.

Private Sub EnableCheckBox_Click()
If Me.EnableCheckBox = -1 Then
Me.YourCalendar = Date
Me.YourCalendar.Enabled = True
ElseIf Me.EnableCheckBox = 0 Then
Me.YourCalendar.Enabled = False
End If
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
B

BillEchert

Our users prefer to use the Calendar for entering dates instead of the text
box with date input mask.

This date is optional. By leaving the checkbox unchecked the field is empty
and the field on the report is blank.

I want to be able to set the value of the calendar control to the current
date (e.g., 12/01/2007) but not enable the checkbox, so that when they choose
to enter a date they check the box, but won't have to navigate from the value
of the date when the calandar control was first created (e.g., 05/15/2006) to
the date they want to enter which will be around the current date.

When I update the date value of the calendar control in the load event to
the current date the control is enabled and the current date prints on the
report. The user would have to uncheck the checkbox to prevent the date from
printing.
When I update the date and disable the control in the load event the control
is totally disabled.

When I set the checkbox to false in the load event the checkbox is removed
from the control.

Is there an event associated with the calendar control's checkbox? Is so,
then when the user enables the check box could I set the date at that point?

Thanks,
Bill
 
L

Linq Adams via AccessMonster.com

BillEchert said:
Our users prefer to use the Calendar for entering dates instead of the text box with date input mask.

I agree with your users! Using calendars for the input of dates is not only
time saving (input masks are a PIA!) but assuress that the input is an actual
date!
This date is optional. By leaving the checkbox unchecked the field is empty
and the field on the report is blank.

I don't understand this point. Are you saying that even when a date isn't
selected it's showing up in the date field and thus appears on the report?
That shouldn't be happeningy, our date field should be empty! How are you
assigning the date selected to the date field?
When I update the date value of the calendar control in the load event to
the current date the control is enabled and the current date prints on the
report.

As I said before, if your Calendar is set up correctly, no date should appear
in the date field unless one has been selected! It sounds like your date
field, as used by your report, is bound to the Calendar instead of the date
text box on your form, and this isn't how it should be.
Is there an event associated with the calendar control's checkbox? Is so,
then when the user enables the check box could I set the date at that point?

As I said in my last post, you can do just that! That's the code I gave you!


Private Sub EnableCheckBox_Click()
If Me.EnableCheckBox = -1 Then
Me.YourCalendar = Date
Me.YourCalendar.Enabled = True
ElseIf Me.EnableCheckBox = 0 Then
Me.YourCalendar.Enabled = False
End If
End Sub
 
M

mustang2

Linq Adams via AccessMonster.com said:
I agree with your users! Using calendars for the input of dates is not
only
time saving (input masks are a PIA!) but assuress that the input is an
actual
date!


I don't understand this point. Are you saying that even when a date isn't
selected it's showing up in the date field and thus appears on the report?
That shouldn't be happeningy, our date field should be empty! How are you
assigning the date selected to the date field?


As I said before, if your Calendar is set up correctly, no date should
appear
in the date field unless one has been selected! It sounds like your date
field, as used by your report, is bound to the Calendar instead of the
date
text box on your form, and this isn't how it should be.


As I said in my last post, you can do just that! That's the code I gave
you!


Private Sub EnableCheckBox_Click()
If Me.EnableCheckBox = -1 Then
Me.YourCalendar = Date
Me.YourCalendar.Enabled = True
ElseIf Me.EnableCheckBox = 0 Then
Me.YourCalendar.Enabled = False
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top