You have all been a great help! Thanks for the quick replies!
I have come up with this code, but am getting an error. Any help?
Run-time error 438
Object doesn't support this property or method.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo Err_Detail_Format
Dim ctl As Control
For Each ctl In Me.Controls
Me(ctl.Name).Visible = Forms!frmBOL!sfrmData.Form!(ctl.Name).Visible
Next ctl
Exit_Detail_Format:
Exit Sub
Err_Detail_Format:
MsgBox Err.Desctiption
Resume Exit_Detail_Format
End Sub
--
Miranda
fredg said:
I am so sorry, I didn't clarify well enough. I have done just that and saved
my form and sub form as a report and subreport. They look identical to my
form with the same set up. My form has code behind it to tell each field to
be hidden or visible depending on what is chosen. I have my report set up to
print only the record that is showing when the print button is clicked. My
problem is that what shows up on the report is not what is visible on the
form. Some of the fields that are hidden on that record in the form are
visible on the report and some of the fields that are visible on that record
in the form are not visible on the report. How do I pass this code to the
report?
Code the Format event of whatever section in the report these possibly
hidden controls are in (i.e. the Detail Format event):
Me![ControlName].Visible = forms!FormName!ControlName.Visible
Do the same for each additional control in the report.
Note: The form must be open when the report is run.