473,770 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Referencing 'RecordSource' in a Sub Report

Hello,
In an Access 2003 Project that uses a SQL Server 2000 database as its
data source, I am attempting to set the RecordSource property of a sub
report called 'RptTeacherHist ory2' that appears in several different
'main' reports. I have tried to use the following code;

Me.RptTeacherHi story2.Properti es("RecordSourc e") = "EXEC
RCTeacherHistor y_sp " & Me.Permnum

'RCTeacherHisto ry' is a proc that takes 'permnum' as a single
parameter. The link Child and Master fields are 'permnum'.

I am trying to use this code on the On Format event of the Report
Header in each of the main forms, but apparently, this is not the way
to reference the RecordSource property of the Sub Report.

Is this something that is possible to do, and if so, how can I do it?

Thanks for your help!

CSDunn
Nov 13 '05 #1
1 3128
The only Event in which the Record Source of a Report may be changed is the
Report's Open Event. You may have some luck if you move the code to the Open
Event of the Report embedded in the Subreport Control.

The "normal" use of Subreports and/or Subforms is to display Records in a
table that is related many-to-one to the Record displayed in the main
Report, by using a Field in the RecordSource of the main Report and a
corresponding Field in the RecordSource of the Report embedded in the
Subreport Control in the LinkMasterField s and LinkChildFields properties of
the Subreport Control to automatically synchronize. In that case, the
RecordSource used in the subform would include all the records.

I see that your RecordSource appears to be a Stored Procedure, and I have
not done what you are attempting to do, so can't offer any specific debug
assistance.

Larry Linson
Microsoft Access MVP

"CSDunn" <cd***@valverde .edu> wrote in message
news:80******** *************** ***@posting.goo gle.com...
Hello,
In an Access 2003 Project that uses a SQL Server 2000 database as its
data source, I am attempting to set the RecordSource property of a sub
report called 'RptTeacherHist ory2' that appears in several different
'main' reports. I have tried to use the following code;

Me.RptTeacherHi story2.Properti es("RecordSourc e") = "EXEC
RCTeacherHistor y_sp " & Me.Permnum

'RCTeacherHisto ry' is a proc that takes 'permnum' as a single
parameter. The link Child and Master fields are 'permnum'.

I am trying to use this code on the On Format event of the Report
Header in each of the main forms, but apparently, this is not the way
to reference the RecordSource property of the Sub Report.

Is this something that is possible to do, and if so, how can I do it?

Thanks for your help!

CSDunn

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4836
by: Radu | last post by:
Hi. I have lots of processing to do on the server - from the client (Access) I call a sproc which returns a recordset (the sproc is essentially a big "select"). With the obtained data , I need to generate a report. How do I set the Recordsource of the report to the result of the select sproc ? I have tried the following, but it does not work. Private Sub cmdReport_Click()
2
2915
by: Koen | last post by:
Hi all, I've struggled with the following problem and welcome all a suggestions to solve this. I have a form that list records from a table with observations. The record source for the table depends on from where the form is opened, but always looks like: SELECT tblObservation.* FROM tblObservation WHERE ...
2
2629
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the form is opened. After the user selects the contact from an unbound combobox I want the form to be rebound to its recordsource. I tried using form.recordsource = "Contacts" in the afterupdate event of
3
1668
by: Tom Seichter | last post by:
Hi Newsgroup, I have a little problem, probably someone can help me. In a report, I have following code: Private Sub Report_Open(Cancel As Integer) Set db = CurrentDb Set qdf = db.QueryDefs("ViewName") qdf!Start = "01/01/2003" qdf!End = "12/31/2003"
9
14890
by: mooseshoes | last post by:
All: I'm using Access 2000 on a Windows XP platform. My goal is to use a form to gather user criteria which I will then parse into a useable SQL string. At this point I would like to open one or more reports and use the query as the recordsource. What would be a common approach to doing this? I have been using ADO methods up until this point for other tasks.
2
1884
by: Gerry Abbott | last post by:
Hi all. Im using a form's recordsource for a report. which works fine Me.RecordSource = Forms("frmdate01").Form.Controls("HoldLog").Form.Controls("frmHoldLog01").Form.RecordSource Ive got a couple of buttons on the form which allows the user to filter from a full recordset, on the form. I now wish to use a date filter when running the report, so that the report takes the filtered recordset (me.recordset)
3
1933
by: Patrik | last post by:
I am changing the recorsource in the onopen event of my report simply using this line : RecordSource = "SELECT * FROM tbl_Temp_ImpressionQuestionnaire WHERE Num_Questionnaire = 19" However how could I pass a parameter defined in another sub to this onopen code to replace 19 with the number chosen by my user. Or WHEN can I define the recordsource other than in the onopen event.
3
9406
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RecordSource of a Master Report is: Me.RecordSource = "TableOrQueryName"
3
10691
by: Simon van Beek | last post by:
Dear reader, How to change the RecordSource for a subReport. For forms the syntaxes is:
0
9595
marktang
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...
0
9432
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,...
0
10232
Oralloy
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...
0
10059
jinu1996
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...
1
10008
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,...
0
9873
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
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
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.