Having Check boxes on one form Generate sub-forms on another form

  • Thread starter Thread starter Chantal
  • Start date Start date
C

Chantal

Help!!

My goal is to create a quote form with specific work.
When something is checked off on the quote form, I need a
seperate pre-formatted form with sub-forms identifying the
work that each check box on the quote form entails.

Basicly what needed is if check box is checked on "Quote"
form then make sub-form (associated with checkbox) appear.

Any feed back would be most appreciated
Chantal
 
Try this:

for each checkbox, type in the itemnumber, (based on what
I was able to determine. The indexing of controls on a
form starts with subforms and starts the indexing at 0 and
increments based on the order in which they were added.)
of the respective subform you want to open in the 'Tag'
field.

Then add this code to the event you want to determine what
is to be shown. code is documented for someone who knows
very little to explain what is being done.

Dim ctl As Control
Dim i As Integer
'i is used to store the index value of the subform you
want effected
'it is easier to pass an index value rather than reassign
the value of a control to
'the control of another control. sounds confusing but
that is what you would be
'doing by storing the value in the tag of the checkbox
control
With Me
'looks at every control on the form
For Each ctl In Controls
'determines if this is a checkbox
If ctl.ControlType = acCheckBox Then
'assigns the tag value to i
i = ctl.Tag
'determines if the checkbox is checked if it
is checked it shows it otherwise
'it hides the subform.
If ctl.Value = True Then
.Controls.Item(i).Visible = True
Else
.Controls.Item(i).Visible = False
End If
Else
End If
Next ctl
End With

I tried this and it should work for you. You may need to
add a refresh action after you have shown the form. or if
they are in a child/parent relationship it should
automtically update.

MW
 
Back
Top