Macro to hide report fields

  • Thread starter Thread starter Jen
  • Start date Start date
J

Jen

I have a very simple database. I am building the
database so the user can upload files to existing tables
and run reports all using forms.

The table where the file is uploaded has 20 fields. The
report that needs to be generated from this table needs
to always show 6 fields (Name, Address, City, State, Zip,
Phone). The remaining 14 fields may or may not be needed
depending on the project.

What I was hoping to do is set up a form with check boxes
for these 14 optional fields. The user could select
which of these optional fields to show on the report and
the report would automatically update based on the user
selection criteria.

What I need is basically a way for the user to check or
uncheck the "Show/Hide" option in a query by using
checkboxes on a form.

Is this possible?
 
Jen,

You can put a macro on the On Open event of the report. The macro can
have a series of actions, one for each of the 14 extras, like this...
Condition: [NameOfFirstCheckbox]<>0
Action: SetValue
Item: [Reports]![NameOfReport]![NameOfControl].[Visible]
Expression: Yes
 
Steve -
This worked! However, the macro is only looking at my
first "action" for the first checkbox. Is there
something that I need to put in between actions so it
looks at all of the variables?
-----Original Message-----
Jen,

You can put a macro on the On Open event of the report. The macro can
have a series of actions, one for each of the 14 extras, like this...
Condition: [NameOfFirstCheckbox]<>0
Action: SetValue
Item: [Reports]![NameOfReport]![NameOfControl]. [Visible]
Expression: Yes

--
Steve Schapel, Microsoft Access MVP

I have a very simple database. I am building the
database so the user can upload files to existing tables
and run reports all using forms.

The table where the file is uploaded has 20 fields. The
report that needs to be generated from this table needs
to always show 6 fields (Name, Address, City, State, Zip,
Phone). The remaining 14 fields may or may not be needed
depending on the project.

What I was hoping to do is set up a form with check boxes
for these 14 optional fields. The user could select
which of these optional fields to show on the report and
the report would automatically update based on the user
selection criteria.

What I need is basically a way for the user to check or
uncheck the "Show/Hide" option in a query by using
checkboxes on a form.

Is this possible?
.
 
Back
Top