Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Access subreport selection from list box

Posted on 2011-02-23
7
Medium Priority
?
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

730 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