Solved

Access 2010 Report as Source Object in Access Form

Posted on 2014-03-19
13
667 Views
Last Modified: 2014-04-22
I have a form which contains a subform control. The SourceObject of the subform control is a report. The code in the Detail Format event of the report does not execute. Of course, if I run the report on its own, the code executes as planned. Is there a way to get code to execute in this scenario?
0
Comment
Question by:TechMommy
  • 7
  • 3
  • 2
  • +1
13 Comments
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39939962
Alison,

Although I cannot recall ever putting a report into a subform control, I'm guessing that when you do, Access uses the ReportView as opposed to the PrintPreview, and a lot of the events in the report don't fire properly in ReportView.

Have you tried manipulating the report behavior from within the main form?
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39939963
>The SourceObject of the subform control is a report.
Even if this is possible, I highly recommend against it, as the properties of a report are different than a form.   For starters, reports are optimized to be printed on paper and with no user interface abilities, so none of the UI capabilities will work here.

Better to create a separate for to act as the subform.
0
 
LVL 11

Author Comment

by:TechMommy
ID: 39939978
I have never had a problem displaying a report in a form. It is a great way for a user to get a quick preview of how their data with be represented in the output. As an example you could have a preview of an invoice showing how the data entry will impact the printed invoice.

Also, manipulating the report behavior from within the main form doesn't work well.

Any additional thoughts or ideas?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 75
ID: 39940322
Sounds like ... this could be a limitation when using a Report in a Form ?
As a test - does code in *any* event in the Report execute ?

mx
0
 
LVL 11

Author Comment

by:TechMommy
ID: 39940329
The open event is the only code that runs. But, when you try to set the Visible property of a text box in the Detail section (for example), it doesn't exist, so the code doesn't execute (Object cannot be found).
0
 
LVL 75
ID: 39940413
Just curious also ... what if this was a subReport in another Report (even if just a blank report). Does the Detail Section code execute then ?

mx
0
 
LVL 11

Author Comment

by:TechMommy
ID: 39940453
Yes, the code executes fine if it is a subreport in another report.
0
 
LVL 75
ID: 39940468
Is this the first time you have tried this, or is it just not working in this instance ?
0
 
LVL 11

Author Comment

by:TechMommy
ID: 39948813
This is the first client that has needed code to execute in the subreport. I've used subreports in forms numerous times, but have just not encountered this specific situation before.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39949106
The only time I ever had to write VBA code in a subreport is to pull off the alternating greybars, before whatever Access version came out with the Alternate Back Color.

Any manipulation of columns (say last_name comma first_name) I was able to pull off in the query that fed your subreport.

So .. tell us what task dictates VBA code behind 'code to execute in the subreport'.
0
 
LVL 11

Author Comment

by:TechMommy
ID: 39949112
The user is requesting that they can view an invoice (report) from within a form. That way they can modify data in the form and preview how the printed invoice will appear. They want to hide and show different controls on the report based on the data in each detail line of the report.
0
 
LVL 11

Accepted Solution

by:
TechMommy earned 0 total points
ID: 40008260
I was never able to solve this problem. Unfortunately none of the comments helped me. I had to preview the subreport as a report. The users weren't happy, but the code executes as planned.
0
 
LVL 11

Author Closing Comment

by:TechMommy
ID: 40014347
Since I did not receive a viable solution, or any particularly helpful comments, I had to abandon what I was trying to accomplish.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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 …

860 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