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?
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
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
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").YourList box.ListCo unt - 1
Me.Controls(Forms("YourFor m").YourLi stbox(i)). visible = Forms("YourForm").YourList Box(i).Sel ected = 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).
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").YourList
Me.Controls(Forms("YourFor
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).
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.
ASKER
I am just having trouble selecting the data based on those selections
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ed