Link to home
Start Free TrialLog in
Avatar of bnrtech
bnrtech

asked on

MS Access subreport selection from list box

It has been a long time since I have worked regularly with MS Access and Access reports, but I am working on an upgrade to an existing system and I am having some issues selecting data for a subreport. I have a listbox where the user can select up to 4 items, and a report with 4 subreports in it.  Is there a way to link each subreport to a selection in the listbox with the vba code?  
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

Do the Link Master Fields and Link Child Fields could not handle the link?

Ed
Avatar of bnrtech
bnrtech

ASKER

Im not sure I follow what you are trying to say.
In the Property Sheet of the Report in Design View, you can set the property of Link Master Fields and Link Child Fields under the All tab.

Basically, those link properties are commonly and effectively used in linking the data of your subreports based on the value in the main report. Try  to use it and see if it is already enough to handle the links you want.


Ed
Avatar of Scott McDaniel (EE MVE )
I believe that the author wishes to show/hide a SubReport based on user selections in form?

If so, you can refer to this during the Open event of your Report, and then show/hide your Subreport based on that. Assuming that your SubReport CONTROL (i.e. the CONTROL on the main Report that is showing the subreport) is named EXACTLY as what is appearing in your listbox:

Dim i As Integer

For i = 0 To Forms("YourForm").YourListbox.ListCount - 1
    Me.Controls(Forms("YourForm").YourListbox(i)).visible = Forms("YourForm").YourListBox(i).Selected = True
Next i

Be careful referring to the SubReport CONTROL. This control has a Property named "Source Object" (which determines which Report is shown) - make sure to look for that Property to insure you're looking at the right control (for naming purposes).
Avatar of bnrtech

ASKER

Actually, I want to show all four at the same time if possible based on what is selected by the user.  If the user select a, b, c,d.  I need the data for a to show in subreport 1, b in 2 and so on, giving a quad chart appearance.
Avatar of bnrtech

ASKER

I am just having trouble selecting the data based on those selections
ASKER CERTIFIED SOLUTION
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial