Solved

Extract Report (preview) from a subform

Posted on 2015-02-15
11
144 Views
Last Modified: 2016-02-11
Hi all,

I am attaching part of a database which provides a search facility but I am hoping whether someone can assist me with the following problem.

I have the object frm_Sections which provides the filtering of sections. When a section or sections are highlighted the components of each section highlighted will appear in the subform.

My question is: How can I then produce a report based on the results which appears in the subform.?

Grateful once again for the assistance.
Please note that the database is done with A97.
SP-ver-EE.mdb
0
Comment
Question by:PipMic
  • 7
  • 2
  • 2
11 Comments
 
LVL 18

Expert Comment

by:Simon
ID: 40611268
I can't open your mdb file on the computer I'm sitting at... You would need to use the same logic in the design of your report (based on highlighted selections of your frm_Sections) as you use for your form/subforms.
0
 

Author Comment

by:PipMic
ID: 40611304
Not sure I understand!
0
 

Author Comment

by:PipMic
ID: 40611310
My idea is to have a print preview button on the form which when pressed would provide a preview of a report with the entries as displayed in the subform...

Not quite sure what you mean by:
You would need to use the same logic in the design of your report (based on highlighted selections of your frm_Sections) as you use for your form/subforms.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40611311
In the OnOpen event for your report set the RecordSource to your subform's recordsource like this:
Me.RecordSource = Forms!frm_Sections!cntDails.Form.RecordSource

As an aside, you should use the ItemsSelected collection to get the list of items selected rather than go through each item selected or not.

Ron
0
 
LVL 18

Expert Comment

by:Simon
ID: 40611313
Sorry, difficult for me to be precise when I can't see your db. If you call the report from a button on the form, you can refer to the current values of controls on the form to determine which sections of the report to show, or, you can filter the datasource of the report on the current values of controls to filter it.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:PipMic
ID: 40611325
I have tried that ....as you've suggested but I can't create the report!

However I am interested to know how to carry out the process you suggest, i.e from the itemsSelected collection rather than the go through each item selected or not.
0
 

Author Comment

by:PipMic
ID: 40611334
Simon , I think that is what Irog (above) is suggesting but I don't know how to do that.
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 40611361
Take a look at the modifications here.  I used the AfterUpdate event of the listbox to update the subform using the ItemsSelected collection.  I also added a print button for your report.  When the report opens, it uses the recordsource of the subform as its recordsource.
SP-ver-EE.mdb
0
 

Author Comment

by:PipMic
ID: 40611799
Hi Iroq,

I can't seem to download your sample database!
0
 

Author Comment

by:PipMic
ID: 40611801
Got it thanks....


 working on it
0
 

Author Comment

by:PipMic
ID: 40611822
Thanks,

Iroq it works a treat.....

In your sample you have actually set it up, looking at the highlighted records in the subform.

I will look up this VBA Function.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now