Recurring items database

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

Guest

I have found a sample database for recurring items built by Duane Hookom. I
have successfully modified it to my needs. On a form, you can choose (with an
option button) whether the item repeats or not. If it repeats, you see
several check boxes to choose your pattern of days. If non-repeating, the
check boxes (and corresponding labels) are hidden and you see a subfrom
appear in their place to enter your individual dates. But, my problem is that
I can hide all the check boxes (ckday in code below) but not the
corresponding labels (the days of the week) as the sample database does. My
code that makes this part of the DB work is below:

Dim ctl As Control
Dim intCounter As Integer
Dim intWeek As Integer
Dim intDay As Integer
Me.txtEndDate.Visible = (Me.grpRepeats = 2)
Me.txtStartDate.Visible = (Me.grpRepeats = 2)
Me.sfrmTempSched.Visible = (Me.grpRepeats = 1)
For intWeek = 0 To 5
For intDay = 1 To 7
Set ctl = Me("chkDay" & intWeek & intDay)
ctl.Visible = (Me.grpRepeats = 2)
ctl.Value = 0
Next
Next
Select Case Me.grpRepeats
Case 2 'repeating
Case 1
End Select
End Sub

My code should be exact from the sample as I have stared at it for hours.
Sample works, mine does not. What could I be missing?

Thanks for any help.
 
Are your labels associated with the checkboxes, or are they labels you added
separately?

I believe you can "reassociate" a label with another control by selecting
the label, cutting it, selecting the control you want to associate the label
with and pasting the label from the clipboard.

If that doesn't work, make sure your labels have a naming convention like
your checkboxes, and add

Set ctl = Me("lblDay" & intWeek & intDay)
ctl.Visible = (Me.grpRepeats = 2)

after your code to set the checkbox visibility.
 
Doug is spot on with the label association. When a check box is set to
invisible, its label will also be invisible.
 
Thanks y'all! The 'cut and paste' thing worked great.
(golf clap)
I also have a question about the design which I will post in db design...
 
Back
Top