Converting a Sub Procedure to A Function



Hi everyone.

I have a very simple query (I think).

I have a form with text boxes for the opening and closing times of a
shop for each day of the week.

I am trying to speed up data entry, and as quite a number of the shops
we are dealing with are open 24 hours I thought that I would try to
automate some of the process. To do this I added a check box to the
form (next to each day) where the OnClick event of the check box sets
the corresponding days opening time to a value of "00:01" and the
closing time to "23:59" (this is how we represent 24 hour opening
where I work).

This all works fine as a Sub, however I then realised that I would
have to duplicate the code 7 times (for each day of the week).

I believe that it would be much better to convert the code so that it
is a function - however I don't know how to do this.

Can anyone guide me along here?

In addition it would also be useful to have another check box that
"Sets all days to 24 hours" - if anyone can give tips on this too I
would be most greatful.

Cheers

Kevin

P.S. Here is the sub routine:

Public Sub chkMon24Hrs_Click()
If Me!chkMon24Hrs.Value = True Then
Me!txtMON_OP.Value = "00:01"
Me!txtMON_CLO.Value = "23:59"
Else
Me!txtMON_OP.Value = Null
Me!txtMON_CLO.Value = Null
End If
End
.