Solved

MS Access subreport selection from list box

Posted on 2011-02-23
7
498 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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 500 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

617 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