Select subreports for Main Report - HELP!

B

Ben

I have a main report and 10 subreports. Let's just say they are called
subreport1, subreport2...etc.

I want to have a box or something where I can select which subreports I want
for the main report. Is that possible? If so, how?

Thanks

Ben
 
R

Rich

It sort of depends on how many subreports you want to display at one time.
Let's say that you want to display just one of the subreports. First, on all
subreports set their visibility to No.

Now, create a small pop-up form with a drop-down list listing all the
subreports that are available. Name the field 'ReportsToView" or whatever you
want. Add a button labeled and named 'OK'. Then code the On-Click event to
read something like this:

If Me![ReportsToView] = "Subreport1" Then
Subreport1.visible = True
End If
DoCmd.CloseForm, "Pop-up Form",,,

If you're going display more than one, you would use an
'If...Then...Else' statement before the End If statement.

In the main report's properties, add either a macro or event code on the 'On
Open' event to open the pop-up form.
 
B

Ben

Rich,
I sorta get what you are saying.

I have to create a normal form and put a drop down menu and list all the
subreport names.

What I want to do is have like checkboxes or something on the from and list
all the subreports. Let's say I want to select 8 out of the 10 subreports
for the main report. So a drop down menu won't work. Just trying to wrap my
head around the procedure to doing this.

Thanks

Ben

Rich said:
It sort of depends on how many subreports you want to display at one time.
Let's say that you want to display just one of the subreports. First, on all
subreports set their visibility to No.

Now, create a small pop-up form with a drop-down list listing all the
subreports that are available. Name the field 'ReportsToView" or whatever you
want. Add a button labeled and named 'OK'. Then code the On-Click event to
read something like this:

If Me![ReportsToView] = "Subreport1" Then
Subreport1.visible = True
End If
DoCmd.CloseForm, "Pop-up Form",,,

If you're going display more than one, you would use an
'If...Then...Else' statement before the End If statement.

In the main report's properties, add either a macro or event code on the 'On
Open' event to open the pop-up form.
--
Rich


Ben said:
I have a main report and 10 subreports. Let's just say they are called
subreport1, subreport2...etc.

I want to have a box or something where I can select which subreports I want
for the main report. Is that possible? If so, how?

Thanks

Ben
 
R

Rich

OK. If you want to use check boxes, then try this:
Again, on the main report, set all the subreports visibility to No.
Set up your check boxes with the name of subreport in the label.
Give each of the boxes a unique name.
The code could be something like this:
If Me![Checkbox1] = -1 Then
Subreport1.Visible = True
Else If
Me![Checkbox2] = -1 Then
Subreport2.Visible = True
Else If
Me![Checkbox3] = 0 Then
Subreport3.Visible = False
End If
And so on...
The -1 means true, that the box has been checked, 0 means false, the box has
not been checked.

There may be a more effiecient way of handling this, but this is what works
for me.

--
Rich


Ben said:
Rich,
I sorta get what you are saying.

I have to create a normal form and put a drop down menu and list all the
subreport names.

What I want to do is have like checkboxes or something on the from and list
all the subreports. Let's say I want to select 8 out of the 10 subreports
for the main report. So a drop down menu won't work. Just trying to wrap my
head around the procedure to doing this.

Thanks

Ben

Rich said:
It sort of depends on how many subreports you want to display at one time.
Let's say that you want to display just one of the subreports. First, on all
subreports set their visibility to No.

Now, create a small pop-up form with a drop-down list listing all the
subreports that are available. Name the field 'ReportsToView" or whatever you
want. Add a button labeled and named 'OK'. Then code the On-Click event to
read something like this:

If Me![ReportsToView] = "Subreport1" Then
Subreport1.visible = True
End If
DoCmd.CloseForm, "Pop-up Form",,,

If you're going display more than one, you would use an
'If...Then...Else' statement before the End If statement.

In the main report's properties, add either a macro or event code on the 'On
Open' event to open the pop-up form.
--
Rich


Ben said:
I have a main report and 10 subreports. Let's just say they are called
subreport1, subreport2...etc.

I want to have a box or something where I can select which subreports I want
for the main report. Is that possible? If so, how?

Thanks

Ben
 
B

Ben

Rich,

I created a form and have a bunch of check boxes. I set all the subreports
to Visible = No.

I coded a command button for one checkbox, as a trial that reads:
Personnel is the name of the subreport.

If Me![Personnel] = -1 Then
Personnel.Visible = True
End if

I then went into the On Open of the main report and i got a debug error.

See any problems?

Ben

Rich said:
OK. If you want to use check boxes, then try this:
Again, on the main report, set all the subreports visibility to No.
Set up your check boxes with the name of subreport in the label.
Give each of the boxes a unique name.
The code could be something like this:
If Me![Checkbox1] = -1 Then
Subreport1.Visible = True
Else If
Me![Checkbox2] = -1 Then
Subreport2.Visible = True
Else If
Me![Checkbox3] = 0 Then
Subreport3.Visible = False
End If
And so on...
The -1 means true, that the box has been checked, 0 means false, the box has
not been checked.

There may be a more effiecient way of handling this, but this is what works
for me.

--
Rich


Ben said:
Rich,
I sorta get what you are saying.

I have to create a normal form and put a drop down menu and list all the
subreport names.

What I want to do is have like checkboxes or something on the from and list
all the subreports. Let's say I want to select 8 out of the 10 subreports
for the main report. So a drop down menu won't work. Just trying to wrap my
head around the procedure to doing this.

Thanks

Ben

Rich said:
It sort of depends on how many subreports you want to display at one time.
Let's say that you want to display just one of the subreports. First, on all
subreports set their visibility to No.

Now, create a small pop-up form with a drop-down list listing all the
subreports that are available. Name the field 'ReportsToView" or whatever you
want. Add a button labeled and named 'OK'. Then code the On-Click event to
read something like this:

If Me![ReportsToView] = "Subreport1" Then
Subreport1.visible = True
End If
DoCmd.CloseForm, "Pop-up Form",,,

If you're going display more than one, you would use an
'If...Then...Else' statement before the End If statement.

In the main report's properties, add either a macro or event code on the 'On
Open' event to open the pop-up form.
--
Rich


:

I have a main report and 10 subreports. Let's just say they are called
subreport1, subreport2...etc.

I want to have a box or something where I can select which subreports I want
for the main report. Is that possible? If so, how?

Thanks

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top