Hello,
I currently have an Access 2003 ADP Report/Subreport set up in which I have
12 subreports in a single main report that are located in a group header
called 'PermnumHeader' (Permnum would be the same as a numeric 'StudentID').
All subreports initially have their visible property set to 'No'.
I have a macro that evaulates the current value of a field in the detail
section of the main report called 'Grade' and a field in the same section
called 'Spanish', then sets the visible property of a single subreport to
'Yes' given a combination the Grade/Spanish values, and sets the visible
property in the other subreports to 'No'.
'Spanish' holds a value of zero or 1. If Spanish is 1, then a Spanish
report is generated, and if Spanish is zero, and English version is
generated.
The PermnumHeader_F ormat event of the PermnumHeader group header in the main
report fires the macro.
The report is designed to allow a teacher to preview a group of report cards
all at once, and have different report cards at different grade levels shown
in one of two languages.
I have attempted to change the way this report is generated, by coding a
procedure to run in the PermnumHeader_F ormat event. The code is as follows:
Private Sub PermnumHeader_F ormat(Cancel As Integer, FormatCount As Integer)
If Me.GRADE = "00" And Me.Spanish = False Then
Child50.SourceO bject = "rptRCK"
ElseIf Me.GRADE = "00" And Me.Spanish = True Then
Child50.SourceO bject = "rptRCKsp"
ElseIf Me.GRADE = "01" And Me.Spanish = False Then
Child50.SourceO bject = "rptRC1"
ElseIf Me.GRADE = "01" And Me.Spanish = True Then
Child50.SourceO bject = "rptRC1sp"
ElseIf Me.GRADE = "02" And Me.Spanish = False Then
Child50.SourceO bject = "rptRC2"
ElseIf Me.GRADE = "02" And Me.Spanish = True Then
Child50.SourceO bject = "rptRC2sp"
ElseIf Me.GRADE = "03" And Me.Spanish = False Then
Child50.SourceO bject = "rptRC3"
ElseIf Me.GRADE = "03" And Me.Spanish = True Then
Child50.SourceO bject = "rptRC3sp"
ElseIf Me.GRADE = "04" And Me.Spanish = False Then
Child50.SourceO bject = "rptRC4-5"
ElseIf Me.GRADE = "04" And Me.Spanish = True Then
Child50.SourceO bject = "rptRCK4-5sp"
ElseIf Me.GRADE = "05" And Me.Spanish = False Then
Child50.SourceO bject = "rptRC4-5"
ElseIf Me.GRADE = "05" And Me.Spanish = True Then
Child50.SourceO bject = "rptRC4-5sp"
Me.PermnumHeade r.OnFormat
End If
End Sub
'Child50' is an 'empty' sub report that only has its link child and master
fields set to 'Permnum'.
The other thing that this code needs to do is set the record source for each
sub report. Normally, where I would just treat the report as a main report I
would handle that in the On Open event of the report as follows:
Private Sub Report_Open (Cancel As Integer, FormatCount As Integer)
Me.RecordSource = "EXEC dbo.RCSingleRCR pt_sp " & Forms!FrmRCMain !Permnum
End Sub
The SQL Server 2000 Stored Procedure, 'RCSingleRCRpt_ sp' takes a 'Permnum'
(StudentID)para meter. The On Open event of the report would probably not
work here since as sub reports, they are not 'opening'. Would I use the On
Current event to set the record source?
Going back to my On Format problem, when I attempt to open the report in
print preview, the code on the On Format event runs for PermnumHeader, and I
get the following message:
"Runtime Error '2191':
You can't set the Source Object property in print preview or after printing
has started."
The report never displays in print preview.
How can I set up my reports/subreports so that On Format will work, and so
that the record sources for each sub report will be set correctly?
Thank you for your help!
CSDunn 3 4887
If you need to change the source object again for every page, you
will have to re-think your design: you can't do that. You can
probably set the source objects in the open event of the report,
or in the first format event of something. Also, the Format Event
has a FormatCount parameter: only set things when FormatCount=1.
If you need to repeatedly reset the recordsource for some object,
another way to do it is to bind to a table, and reload the table
for each page.
"CSDunn" <cd***@valverde .edu> wrote in message
news:80******** *************** ***@posting.goo gle.com... Hello, I currently have an Access 2003 ADP Report/Subreport set up in which I
have 12 subreports in a single main report that are located in a group header called 'PermnumHeader' (Permnum would be the same as a numeric
'StudentID'). All subreports initially have their visible property set to 'No'.
I have a macro that evaulates the current value of a field in the detail section of the main report called 'Grade' and a field in the same section called 'Spanish', then sets the visible property of a single subreport to 'Yes' given a combination the Grade/Spanish values, and sets the visible property in the other subreports to 'No'.
'Spanish' holds a value of zero or 1. If Spanish is 1, then a Spanish report is generated, and if Spanish is zero, and English version is generated.
The PermnumHeader_F ormat event of the PermnumHeader group header in the
main report fires the macro.
The report is designed to allow a teacher to preview a group of report
cards all at once, and have different report cards at different grade levels
shown in one of two languages.
I have attempted to change the way this report is generated, by coding a procedure to run in the PermnumHeader_F ormat event. The code is as
follows: Private Sub PermnumHeader_F ormat(Cancel As Integer, FormatCount As
Integer) If Me.GRADE = "00" And Me.Spanish = False Then Child50.SourceO bject = "rptRCK" ElseIf Me.GRADE = "00" And Me.Spanish = True Then Child50.SourceO bject = "rptRCKsp"
ElseIf Me.GRADE = "01" And Me.Spanish = False Then Child50.SourceO bject = "rptRC1" ElseIf Me.GRADE = "01" And Me.Spanish = True Then Child50.SourceO bject = "rptRC1sp"
ElseIf Me.GRADE = "02" And Me.Spanish = False Then Child50.SourceO bject = "rptRC2" ElseIf Me.GRADE = "02" And Me.Spanish = True Then Child50.SourceO bject = "rptRC2sp"
ElseIf Me.GRADE = "03" And Me.Spanish = False Then Child50.SourceO bject = "rptRC3" ElseIf Me.GRADE = "03" And Me.Spanish = True Then Child50.SourceO bject = "rptRC3sp"
ElseIf Me.GRADE = "04" And Me.Spanish = False Then Child50.SourceO bject = "rptRC4-5" ElseIf Me.GRADE = "04" And Me.Spanish = True Then Child50.SourceO bject = "rptRCK4-5sp"
ElseIf Me.GRADE = "05" And Me.Spanish = False Then Child50.SourceO bject = "rptRC4-5" ElseIf Me.GRADE = "05" And Me.Spanish = True Then Child50.SourceO bject = "rptRC4-5sp" Me.PermnumHeade r.OnFormat
End If End Sub
'Child50' is an 'empty' sub report that only has its link child and master fields set to 'Permnum'.
The other thing that this code needs to do is set the record source for
each sub report. Normally, where I would just treat the report as a main report
I would handle that in the On Open event of the report as follows:
Private Sub Report_Open (Cancel As Integer, FormatCount As Integer) Me.RecordSource = "EXEC dbo.RCSingleRCR pt_sp " & Forms!FrmRCMain !Permnum End Sub
The SQL Server 2000 Stored Procedure, 'RCSingleRCRpt_ sp' takes a 'Permnum' (StudentID)para meter. The On Open event of the report would probably not work here since as sub reports, they are not 'opening'. Would I use the On Current event to set the record source?
Going back to my On Format problem, when I attempt to open the report in print preview, the code on the On Format event runs for PermnumHeader, and
I get the following message:
"Runtime Error '2191': You can't set the Source Object property in print preview or after
printing has started."
The report never displays in print preview.
How can I set up my reports/subreports so that On Format will work, and so that the record sources for each sub report will be set correctly?
Thank you for your help!
CSDunn
David,
Thanks for your help. The record source can be made the same for each
report, I would just need to reconfigure how the reports are used when
they are viewed individually.
Maybe I'll have to go back to having the reports 'stacked' again as
sub reports in a main report.
CSDunn
"david epsom dot com dot au" <david@epsomdot comdotau> wrote in message news:<40******* *************** *@news.syd.swif tdsl.com.au>... If you need to change the source object again for every page, you will have to re-think your design: you can't do that. You can probably set the source objects in the open event of the report, or in the first format event of something. Also, the Format Event has a FormatCount parameter: only set things when FormatCount=1.
If you need to repeatedly reset the recordsource for some object, another way to do it is to bind to a table, and reload the table for each page.
"CSDunn" <cd***@valverde .edu> wrote in message news:80******** *************** ***@posting.goo gle.com... Hello, I currently have an Access 2003 ADP Report/Subreport set up in which I have 12 subreports in a single main report that are located in a group header called 'PermnumHeader' (Permnum would be the same as a numeric 'StudentID'). All subreports initially have their visible property set to 'No'.
I have a macro that evaulates the current value of a field in the detail section of the main report called 'Grade' and a field in the same section called 'Spanish', then sets the visible property of a single subreport to 'Yes' given a combination the Grade/Spanish values, and sets the visible property in the other subreports to 'No'.
'Spanish' holds a value of zero or 1. If Spanish is 1, then a Spanish report is generated, and if Spanish is zero, and English version is generated.
The PermnumHeader_F ormat event of the PermnumHeader group header in the main report fires the macro.
The report is designed to allow a teacher to preview a group of report cards all at once, and have different report cards at different grade levels shown in one of two languages.
I have attempted to change the way this report is generated, by coding a procedure to run in the PermnumHeader_F ormat event. The code is as follows: Private Sub PermnumHeader_F ormat(Cancel As Integer, FormatCount As
Integer) If Me.GRADE = "00" And Me.Spanish = False Then Child50.SourceO bject = "rptRCK" ElseIf Me.GRADE = "00" And Me.Spanish = True Then Child50.SourceO bject = "rptRCKsp"
ElseIf Me.GRADE = "01" And Me.Spanish = False Then Child50.SourceO bject = "rptRC1" ElseIf Me.GRADE = "01" And Me.Spanish = True Then Child50.SourceO bject = "rptRC1sp"
ElseIf Me.GRADE = "02" And Me.Spanish = False Then Child50.SourceO bject = "rptRC2" ElseIf Me.GRADE = "02" And Me.Spanish = True Then Child50.SourceO bject = "rptRC2sp"
ElseIf Me.GRADE = "03" And Me.Spanish = False Then Child50.SourceO bject = "rptRC3" ElseIf Me.GRADE = "03" And Me.Spanish = True Then Child50.SourceO bject = "rptRC3sp"
ElseIf Me.GRADE = "04" And Me.Spanish = False Then Child50.SourceO bject = "rptRC4-5" ElseIf Me.GRADE = "04" And Me.Spanish = True Then Child50.SourceO bject = "rptRCK4-5sp"
ElseIf Me.GRADE = "05" And Me.Spanish = False Then Child50.SourceO bject = "rptRC4-5" ElseIf Me.GRADE = "05" And Me.Spanish = True Then Child50.SourceO bject = "rptRC4-5sp" Me.PermnumHeade r.OnFormat
End If End Sub
'Child50' is an 'empty' sub report that only has its link child and master fields set to 'Permnum'.
The other thing that this code needs to do is set the record source for
each sub report. Normally, where I would just treat the report as a main report I would handle that in the On Open event of the report as follows:
Private Sub Report_Open (Cancel As Integer, FormatCount As Integer) Me.RecordSource = "EXEC dbo.RCSingleRCR pt_sp " & Forms!FrmRCMain !Permnum End Sub
The SQL Server 2000 Stored Procedure, 'RCSingleRCRpt_ sp' takes a 'Permnum' (StudentID)para meter. The On Open event of the report would probably not work here since as sub reports, they are not 'opening'. Would I use the On Current event to set the record source?
Going back to my On Format problem, when I attempt to open the report in print preview, the code on the On Format event runs for PermnumHeader, and I get the following message:
"Runtime Error '2191': You can't set the Source Object property in print preview or after printing has started."
The report never displays in print preview.
How can I set up my reports/subreports so that On Format will work, and so that the record sources for each sub report will be set correctly?
Thank you for your help!
CSDunn
Even just setting a sub report to not visible may force it to not
calculate at all - there may not be any real overhead to using
stacked sub-reports. You may also try to use the "link child fields/
link master fields" properties - it may speed up your report because
the sub-reports won't calculate if they are empty. Another option
might be to dynamically reconfigure a single sub-report: you can
shift controls and make them visible/invisible in the format event
for a section.
"CSDunn" <cd***@valverde .edu> wrote in message
news:80******** *************** ***@posting.goo gle.com... David, Thanks for your help. The record source can be made the same for each report, I would just need to reconfigure how the reports are used when they are viewed individually.
Maybe I'll have to go back to having the reports 'stacked' again as sub reports in a main report.
CSDunn
"david epsom dot com dot au" <david@epsomdot comdotau> wrote in message
news:<40******* *************** *@news.syd.swif tdsl.com.au>... If you need to change the source object again for every page, you will have to re-think your design: you can't do that. You can probably set the source objects in the open event of the report, or in the first format event of something. Also, the Format Event has a FormatCount parameter: only set things when FormatCount=1.
If you need to repeatedly reset the recordsource for some object, another way to do it is to bind to a table, and reload the table for each page.
"CSDunn" <cd***@valverde .edu> wrote in message news:80******** *************** ***@posting.goo gle.com... Hello, I currently have an Access 2003 ADP Report/Subreport set up in which I have 12 subreports in a single main report that are located in a group
header called 'PermnumHeader' (Permnum would be the same as a numeric 'StudentID'). All subreports initially have their visible property set to 'No'.
I have a macro that evaulates the current value of a field in the
detail section of the main report called 'Grade' and a field in the same
section called 'Spanish', then sets the visible property of a single subreport
to 'Yes' given a combination the Grade/Spanish values, and sets the
visible property in the other subreports to 'No'.
'Spanish' holds a value of zero or 1. If Spanish is 1, then a Spanish report is generated, and if Spanish is zero, and English version is generated.
The PermnumHeader_F ormat event of the PermnumHeader group header in
the main report fires the macro.
The report is designed to allow a teacher to preview a group of report cards all at once, and have different report cards at different grade levels shown in one of two languages.
I have attempted to change the way this report is generated, by coding
a procedure to run in the PermnumHeader_F ormat event. The code is as follows: Private Sub PermnumHeader_F ormat(Cancel As Integer, FormatCount As
Integer) If Me.GRADE = "00" And Me.Spanish = False Then Child50.SourceO bject = "rptRCK" ElseIf Me.GRADE = "00" And Me.Spanish = True Then Child50.SourceO bject = "rptRCKsp"
ElseIf Me.GRADE = "01" And Me.Spanish = False Then Child50.SourceO bject = "rptRC1" ElseIf Me.GRADE = "01" And Me.Spanish = True Then Child50.SourceO bject = "rptRC1sp"
ElseIf Me.GRADE = "02" And Me.Spanish = False Then Child50.SourceO bject = "rptRC2" ElseIf Me.GRADE = "02" And Me.Spanish = True Then Child50.SourceO bject = "rptRC2sp"
ElseIf Me.GRADE = "03" And Me.Spanish = False Then Child50.SourceO bject = "rptRC3" ElseIf Me.GRADE = "03" And Me.Spanish = True Then Child50.SourceO bject = "rptRC3sp"
ElseIf Me.GRADE = "04" And Me.Spanish = False Then Child50.SourceO bject = "rptRC4-5" ElseIf Me.GRADE = "04" And Me.Spanish = True Then Child50.SourceO bject = "rptRCK4-5sp"
ElseIf Me.GRADE = "05" And Me.Spanish = False Then Child50.SourceO bject = "rptRC4-5" ElseIf Me.GRADE = "05" And Me.Spanish = True Then Child50.SourceO bject = "rptRC4-5sp" Me.PermnumHeade r.OnFormat
End If End Sub
'Child50' is an 'empty' sub report that only has its link child and
master fields set to 'Permnum'.
The other thing that this code needs to do is set the record source
for each sub report. Normally, where I would just treat the report as a main
report I would handle that in the On Open event of the report as follows:
Private Sub Report_Open (Cancel As Integer, FormatCount As Integer) Me.RecordSource = "EXEC dbo.RCSingleRCR pt_sp " &
Forms!FrmRCMain !Permnum End Sub
The SQL Server 2000 Stored Procedure, 'RCSingleRCRpt_ sp' takes a
'Permnum' (StudentID)para meter. The On Open event of the report would probably
not work here since as sub reports, they are not 'opening'. Would I use
the On Current event to set the record source?
Going back to my On Format problem, when I attempt to open the report
in print preview, the code on the On Format event runs for PermnumHeader,
and I get the following message:
"Runtime Error '2191': You can't set the Source Object property in print preview or after printing has started."
The report never displays in print preview.
How can I set up my reports/subreports so that On Format will work,
and so that the record sources for each sub report will be set correctly?
Thank you for your help!
CSDunn This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dixie |
last post by:
I have a report with a subreport. The source object for this subreport
varies according to the value of a field in a table. I am trying to
programmatically set the object source for the subreport as part of the
detail format section of the report. I have been playing around with things
like:
Me.SubReport.SourceObject = Report.sub5O5L
but nothing seems to work. Can I achieve what I want to do and if so, can
anyone give me the...
|
by: Jacob Barnett |
last post by:
Access 2000 main report does not display subreport data in preview and
may or may not print... sometimes. Usually, the entire report is
fine. The behavior does not seem to depend on particular records or
data and I have not found a reliable way to reproduce the behavior.
The subreport can always be generated independently and always prints.
There is data in both the main report and the subreport. The link
child and master fields are...
|
by: CSDunn |
last post by:
Hello,
I currently have an Access 2003 ADP Report/Subreport set up in which I have
12 subreports in a single main report that are located in a group header
called 'PermnumHeader' (Permnum would be the same as a numeric 'StudentID').
All subreports initially have their visible property set to 'No'.
I have a macro that evaulates the current value of a field in the detail
section of the main report called 'Grade' and a field in the same...
|
by: Downstreamer |
last post by:
Design is as follows:
A form for the user to input criteria to be used as the where part of
the report's recordsource. This includes a multiselect list box as part
of the criteria selection.
The report is generated from a button on this form. In the button's
onclick event a where clause is built and assigned to a public variable.
Because of the multiselect listbox I use IN as part of the where
clause, for example, sqlstr = " ...
|
by: Ellen Manning |
last post by:
I've got an A2K report showing students and their costs. Student info
is in the main report and costs are in a subreport for each student.
The user inputs the program desired then only those students in that
program are printed.
I want the subreports headings to print only for the first student on
the page. Is there a way to suppress printing of the headings on
subsequent students on that page?
I tried the following in both the...
| |
by: Kirsty Ryder |
last post by:
Hi,
I have a Report with a subreport, and I want to assign a value to the
control source of a control on the subreport depending on the value
given by the user in a separate form. Based on advice from the online
help and from other posts in this group, I wrote the following code
which is called on the On Open even of the main report. I have tried
several variations on this, which always result in the same error
message-
|
by: Simon |
last post by:
Dear reader,
The syntax for the VBA code to change the RowSource of a Master Report is:
Me.RowSource = "TableOrQueryName"
|
by: Breezwell |
last post by:
First off, let me say that this forum has provided me with numerous guidance to Access programming challenges I have faced while learning, and I am grateful to all those who share thier knowledge with others.
My current question involves SourceObjects. I have a form that has three SourceObjects, each of which displays the results of a query designed just for that particular SourceObject. Each SourceObject will reaveal information from a...
|
by: Simon van Beek |
last post by:
Dear reader,
How to change the RecordSource for a subReport.
For forms the syntaxes is:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |