RE: Changing a Sub Procedure to a Function
- From: Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Feb 2008 08:05:03 -0800
You question was answered in another group.
Cross posting is frowned upon. Please review the info on this site:
http://www.mvps.org/access/netiquette.htm
--
Dave Hargis, Microsoft Access MVP
"KevinC" wrote:
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 grateful.
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
- Follow-Ups:
- Re: Changing a Sub Procedure to a Function
- From: KevinC
- Re: Changing a Sub Procedure to a Function
- References:
- Changing a Sub Procedure to a Function
- From: KevinC
- Changing a Sub Procedure to a Function
- Prev by Date: Re: Create an Access 2000 format database using DAO?
- Next by Date: Re: Stop command button disabling with filter by form
- Previous by thread: Changing a Sub Procedure to a Function
- Next by thread: Re: Changing a Sub Procedure to a Function
- Index(es):