This approach will enable/disable all four controls on each record displayed
in your subform.
If that's what you want, great!
If you're looking to show different controls disabled on different records
in your subform, you might be stuck with textboxes - and a different coding
approach.
HTH
- Turtle
SteveS said:
1) Add the code below to your form
2) Change the control names to the ones you use
3) Set the Timer Interval to 1000 (=1 second) (Form properties/Event)
'-----Start Code------------------
Private Sub Form_Timer()
' uncomment the following line if you want to use the day Name
'If UCase(WeekdayName(Weekday(Date))) = "MONDAY" Then
'comment the following line if using day Name
If Weekday(Date) = 2 Then ' 2 = Monday
' hours between 7AM and 10AM
If Hour(Now()) >= 7 And Hour(Now()) <= 10 Then
'can't disable if control has focus so move it to
'another control, button, etc or close the form
Me.Text8.SetFocus
Me.Text0.Enabled = False
Me.Text2.Enabled = False
Me.Text4.Enabled = False
Me.Text6.Enabled = False
Else
Me.Text0.Enabled = True
Me.Text2.Enabled = True
Me.Text4.Enabled = True
Me.Text6.Enabled = True
End If
End If
End Sub
'-----End Code--------------------
Note: the timer runs the code every second that the form is open. If that
slows Access down too much for you, change the timer interval to 5000 (5
seconds)..... the timer interval number is calculated by: