Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS Access subreport selection from list box

Posted on 2011-02-23
7
Medium Priority
?
523 Views
Last Modified: 2012-05-11
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?  
0
Comment
Question by:bnrtech
  • 3
  • 3
7 Comments
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34960388
Do the Link Master Fields and Link Child Fields could not handle the link?

Ed
0
 

Author Comment

by:bnrtech
ID: 34960440
Im not sure I follow what you are trying to say.
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34960526
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 85
ID: 34960569
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).
0
 

Author Comment

by:bnrtech
ID: 34960615
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.
0
 

Author Comment

by:bnrtech
ID: 34960619
I am just having trouble selecting the data based on those selections
0
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 2000 total points
ID: 34960676
I may suggest to use 4 different list boxes and assigned one list box to each subreport by linking them using the properties I posted at ID: 34960526.

You may hardly do VBA - ? - with one list box having 4 unique information selected.

Sincerely,
Ed
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question