Activating a command button after a certain date passes.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to code a cmd button to be active once a certain date passes.
For example I am setting up a database form that will show sales for November
and December but don't want the December button to be active until December
2nd. The button name is cmdDecSales. I am trying to apply this code when
the Form Opens. Any help would be appreciated.

Thanks,
Chris
 
hi Chris,
I am trying to code a cmd button to be active once a certain date passes.
For example I am setting up a database form that will show sales for November
and December but don't want the December button to be active until December
2nd. The button name is cmdDecSales. I am trying to apply this code when
the Form Opens. Any help would be appreciated.

Private Sub Form_Open(Cancel As Integer)

cmdDecSales.Enabled = (Date() > #12/01/2006#)

End Sub


mfG
--> stefan <--
 
Chris said:
I am trying to code a cmd button to be active once a certain date passes.
For example I am setting up a database form that will show sales for November
and December but don't want the December button to be active until December
2nd. The button name is cmdDecSales. I am trying to apply this code when
the Form Opens.


Me.cmdDecSales.Enabled = (Format(Date,"mmdd") >= "1202")

Because your example was for December, I can't tell what you
want to happen in January. The line above will disable the
button again until the next December.

If you have a button for each month and want all the months
to be enabled only during the month:

Me.cmdDecSales.Enabled = (Month(Date) = 12)
 
Back
Top