Disabling Command Button

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

Hi. I placed the Activex Calendar control (axcCalendar) and a command button
(cmdToday)
on an unbound form. The command button when clicked returns axcCalendar to
today if
need be. Although there are no problems I would like cmdToday to be disabled
if axcCalendar's
current day is selected. I've placed the following in several places
including the OnCurrent of the
form and the OnUpdated of axcCalendar with no success.

Private Sub axcCalendar_Updated(Code As Integer)

If Me!axcCalendar.Today Then

Me!cmdToday.Enabled = False

Else

Me!cmdToday.Enabled = True

End If

End Sub

I've also tried replacing the first line with:

If Me!axcCalendar.Value = Date

Any help will be appreciated.

Thanks,
James
 
A couple of things here: -

1. The code needs to be applied to the controls "On Exit"
procedure, if you have the code on the "After Update"
procedure it will not work.
2. You need to compare dates by using the following
code: -

Me.cmdToday.Enabled=True
If Me.axcCalendar.Value <> Date() Then Exit Sub
Me.cmdToday.Enabled=False

HTH

Tony C
 
Back
Top