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_Format 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_Format event. The code is as follows:
Private Sub PermnumHeader_Format(Cancel As Integer, FormatCount As Integer)
If Me.GRADE = "00" And Me.Spanish = False Then
Child50.SourceObject = "rptRCK"
ElseIf Me.GRADE = "00" And Me.Spanish = True Then
Child50.SourceObject = "rptRCKsp"
ElseIf Me.GRADE = "01" And Me.Spanish = False Then
Child50.SourceObject = "rptRC1"
ElseIf Me.GRADE = "01" And Me.Spanish = True Then
Child50.SourceObject = "rptRC1sp"
ElseIf Me.GRADE = "02" And Me.Spanish = False Then
Child50.SourceObject = "rptRC2"
ElseIf Me.GRADE = "02" And Me.Spanish = True Then
Child50.SourceObject = "rptRC2sp"
ElseIf Me.GRADE = "03" And Me.Spanish = False Then
Child50.SourceObject = "rptRC3"
ElseIf Me.GRADE = "03" And Me.Spanish = True Then
Child50.SourceObject = "rptRC3sp"
ElseIf Me.GRADE = "04" And Me.Spanish = False Then
Child50.SourceObject = "rptRC4-5"
ElseIf Me.GRADE = "04" And Me.Spanish = True Then
Child50.SourceObject = "rptRCK4-5sp"
ElseIf Me.GRADE = "05" And Me.Spanish = False Then
Child50.SourceObject = "rptRC4-5"
ElseIf Me.GRADE = "05" And Me.Spanish = True Then
Child50.SourceObject = "rptRC4-5sp"
Me.PermnumHeader.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.RCSingleRCRpt_sp " & Forms!FrmRCMain!Permnum
End Sub
The SQL Server 2000 Stored Procedure, 'RCSingleRCRpt_sp' takes a 'Permnum'
(StudentID)parameter. 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 4836
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.google.c om... 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_Format 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_Format event. The code is as
follows: Private Sub PermnumHeader_Format(Cancel As Integer, FormatCount As
Integer) If Me.GRADE = "00" And Me.Spanish = False Then Child50.SourceObject = "rptRCK" ElseIf Me.GRADE = "00" And Me.Spanish = True Then Child50.SourceObject = "rptRCKsp"
ElseIf Me.GRADE = "01" And Me.Spanish = False Then Child50.SourceObject = "rptRC1" ElseIf Me.GRADE = "01" And Me.Spanish = True Then Child50.SourceObject = "rptRC1sp"
ElseIf Me.GRADE = "02" And Me.Spanish = False Then Child50.SourceObject = "rptRC2" ElseIf Me.GRADE = "02" And Me.Spanish = True Then Child50.SourceObject = "rptRC2sp"
ElseIf Me.GRADE = "03" And Me.Spanish = False Then Child50.SourceObject = "rptRC3" ElseIf Me.GRADE = "03" And Me.Spanish = True Then Child50.SourceObject = "rptRC3sp"
ElseIf Me.GRADE = "04" And Me.Spanish = False Then Child50.SourceObject = "rptRC4-5" ElseIf Me.GRADE = "04" And Me.Spanish = True Then Child50.SourceObject = "rptRCK4-5sp"
ElseIf Me.GRADE = "05" And Me.Spanish = False Then Child50.SourceObject = "rptRC4-5" ElseIf Me.GRADE = "05" And Me.Spanish = True Then Child50.SourceObject = "rptRC4-5sp" Me.PermnumHeader.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.RCSingleRCRpt_sp " & Forms!FrmRCMain!Permnum End Sub
The SQL Server 2000 Stored Procedure, 'RCSingleRCRpt_sp' takes a 'Permnum' (StudentID)parameter. 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@epsomdotcomdotau> wrote in message news:<40***********************@news.syd.swiftdsl. 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.google.c om... 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_Format 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_Format event. The code is as follows: Private Sub PermnumHeader_Format(Cancel As Integer, FormatCount As
Integer) If Me.GRADE = "00" And Me.Spanish = False Then Child50.SourceObject = "rptRCK" ElseIf Me.GRADE = "00" And Me.Spanish = True Then Child50.SourceObject = "rptRCKsp"
ElseIf Me.GRADE = "01" And Me.Spanish = False Then Child50.SourceObject = "rptRC1" ElseIf Me.GRADE = "01" And Me.Spanish = True Then Child50.SourceObject = "rptRC1sp"
ElseIf Me.GRADE = "02" And Me.Spanish = False Then Child50.SourceObject = "rptRC2" ElseIf Me.GRADE = "02" And Me.Spanish = True Then Child50.SourceObject = "rptRC2sp"
ElseIf Me.GRADE = "03" And Me.Spanish = False Then Child50.SourceObject = "rptRC3" ElseIf Me.GRADE = "03" And Me.Spanish = True Then Child50.SourceObject = "rptRC3sp"
ElseIf Me.GRADE = "04" And Me.Spanish = False Then Child50.SourceObject = "rptRC4-5" ElseIf Me.GRADE = "04" And Me.Spanish = True Then Child50.SourceObject = "rptRCK4-5sp"
ElseIf Me.GRADE = "05" And Me.Spanish = False Then Child50.SourceObject = "rptRC4-5" ElseIf Me.GRADE = "05" And Me.Spanish = True Then Child50.SourceObject = "rptRC4-5sp" Me.PermnumHeader.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.RCSingleRCRpt_sp " & Forms!FrmRCMain!Permnum End Sub
The SQL Server 2000 Stored Procedure, 'RCSingleRCRpt_sp' takes a 'Permnum' (StudentID)parameter. 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.google.c om... 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@epsomdotcomdotau> wrote in message
news:<40***********************@news.syd.swiftdsl. 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.google.c om... 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_Format 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_Format event. The code is as follows: Private Sub PermnumHeader_Format(Cancel As Integer, FormatCount As
Integer) If Me.GRADE = "00" And Me.Spanish = False Then Child50.SourceObject = "rptRCK" ElseIf Me.GRADE = "00" And Me.Spanish = True Then Child50.SourceObject = "rptRCKsp"
ElseIf Me.GRADE = "01" And Me.Spanish = False Then Child50.SourceObject = "rptRC1" ElseIf Me.GRADE = "01" And Me.Spanish = True Then Child50.SourceObject = "rptRC1sp"
ElseIf Me.GRADE = "02" And Me.Spanish = False Then Child50.SourceObject = "rptRC2" ElseIf Me.GRADE = "02" And Me.Spanish = True Then Child50.SourceObject = "rptRC2sp"
ElseIf Me.GRADE = "03" And Me.Spanish = False Then Child50.SourceObject = "rptRC3" ElseIf Me.GRADE = "03" And Me.Spanish = True Then Child50.SourceObject = "rptRC3sp"
ElseIf Me.GRADE = "04" And Me.Spanish = False Then Child50.SourceObject = "rptRC4-5" ElseIf Me.GRADE = "04" And Me.Spanish = True Then Child50.SourceObject = "rptRCK4-5sp"
ElseIf Me.GRADE = "05" And Me.Spanish = False Then Child50.SourceObject = "rptRC4-5" ElseIf Me.GRADE = "05" And Me.Spanish = True Then Child50.SourceObject = "rptRC4-5sp" Me.PermnumHeader.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.RCSingleRCRpt_sp " &
Forms!FrmRCMain!Permnum End Sub
The SQL Server 2000 Stored Procedure, 'RCSingleRCRpt_sp' takes a
'Permnum' (StudentID)parameter. 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...
|
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...
|
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...
|
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.
...
|
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...
|
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...
|
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...
|
by: Simon van Beek |
last post by:
Dear reader,
How to change the RecordSource for a subReport.
For forms the syntaxes is:
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
| |