gmillerinc
IS-IT--Management
I have a form (that is you used for our Time Tracking here at my job) that is based upon a table. The form has check boxes that grays out times (in the form of check boxes on the form) as the day goes along.
For instance, if I clicked check boxes 6-6:30 AM and 6:30-7AM, then this is recorded in the underlying table and the times are grayed out...which I put it this way so that users can not go and put more than one task for each 30 minute increment. These check box times on the forms are fields in the underlying table.
The problem here is that when I close the form and come back into it, guess what...the check boxes are no longer there. I tried the Unload event but its not working.
I used the Unload event here:
Private Sub Form_Unload(Cancel As Integer)
If (Me![6to630] = True) Then Me![6to630].Enabled = False
If (Me![630to7] = True) Then Me![630to7].Enabled = False
If (Me![7to730] = True) Then Me![7to730].Enabled = False
If (Me![730to8] = True) Then Me![730to8].Enabled = False
If (Me![8to830] = True) Then Me![8to830].Enabled = False
If (Me![830to9] = True) Then Me![830to9].Enabled = False
End Sub
For example 6to630 is the name of a check box. I want it to gray out...which is what 'Enabled = False' supposed to do if the box is check.
When I read the definition of an Unload event in Access, it seems exactly like what I need. According to Access 97, the Unload event is defined as follows: "The Unload event occurs after a form is closed but before it's removed from the screen. When the form is reloaded, Microsoft Access redisplays the form and reinitializes the contents of all its controls."
If you want to suggest another way, please advise. Please help, this shouldn't be complicated at all.
For instance, if I clicked check boxes 6-6:30 AM and 6:30-7AM, then this is recorded in the underlying table and the times are grayed out...which I put it this way so that users can not go and put more than one task for each 30 minute increment. These check box times on the forms are fields in the underlying table.
The problem here is that when I close the form and come back into it, guess what...the check boxes are no longer there. I tried the Unload event but its not working.
I used the Unload event here:
Private Sub Form_Unload(Cancel As Integer)
If (Me![6to630] = True) Then Me![6to630].Enabled = False
If (Me![630to7] = True) Then Me![630to7].Enabled = False
If (Me![7to730] = True) Then Me![7to730].Enabled = False
If (Me![730to8] = True) Then Me![730to8].Enabled = False
If (Me![8to830] = True) Then Me![8to830].Enabled = False
If (Me![830to9] = True) Then Me![830to9].Enabled = False
End Sub
For example 6to630 is the name of a check box. I want it to gray out...which is what 'Enabled = False' supposed to do if the box is check.
When I read the definition of an Unload event in Access, it seems exactly like what I need. According to Access 97, the Unload event is defined as follows: "The Unload event occurs after a form is closed but before it's removed from the screen. When the form is reloaded, Microsoft Access redisplays the form and reinitializes the contents of all its controls."
If you want to suggest another way, please advise. Please help, this shouldn't be complicated at all.