472,806 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,806 software developers and data experts.

Report with subreport - one-to-many relationship

Hello,

I have a report which uses a subreport. When I run the report, I get
"Enter Parameter Value" error message for "tblGuestRoom". I click ok
and the report seems to work fine.

I narrowed down this error to the Link Master Fields property setting,
when I tried the same scenario with form/subform. It gave me error:
'The Link Master fields property setting has produced this error: The
object doesn't contain the Automation object 'tblGuestRoom'. Error
happened when I clicked 'next record' while viewing what should have
been the last row for subreport's RecordSource table where key matched
main report's current record (see below).

Here is the picture of how things are set up:
--Main report is "rptReport1". RecordSource is "qryQuery1", which uses
2 tables: tblGuestRoom, the table coming up in the error, and
tblBathroom. They both have primary key of RoomNumber.
--Subreport is "rsubReport1", with RecordSource tblWindow.
TblGuestRoom to tblWindow is a one-to-many relationship, on key
RoomNumber. I think the problem lies with not defining the
relationship from main report to subreport correctly (I am relatively
new to Access, but a programmer). Perhaps I didn't set my
relationships up correctly, or Link Master, or it doesn't know the
one-to-many relationship?? (although seems to be displaying fine).
--On the main report, properties for subreport are as follows:
SourceObject = the subreport. Link Child Fields =tblWindow.RoomNumber,
and Link Master Fields = tblGuestRoom.RoomNumber. In Relationships,
there is a 1 to many relationship between tblGuestRoom and tblWindow.
Does the subreport know this, or do I need to tell it that somehow?
Where do I tell it this? I suspect that this is where my problem lies.
The strange thing is, report data looks correct.

Thank you in advance for any help,
Lori

Nov 13 '05 #1
3 7314
Did you include both RoomNumber fields in the Query on which is the main
Report's RecordSource? Because this is a Report and you cannot be updating
the data, one RoomNumber Field will be sufficient, and you will not need to
qualify with the Table name. If it were a Form, where you do need both Key
Fields, you could rename the RoomNumber fields (NewName: OldName in the
Query Builder Grid or use the AS clause in SQL) to make them easy to
distinguish without qualifying with the Table name.

As there can be only one RoomNumber field in the Report embedded in the
Subreport Control, you do not need to qualify it with the TableName, in any
case.

Form / Subform or Report / Subreport work just fine for one-to-many without
being informed. One-to-one is just a "subset" of one-to-many, in this sense.

Sometimes you can create problems for yourself by giving Access more
information than it needs.

Larry Linson
Microsoft Access MVP

"lorirobn" <lo******@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hello,

I have a report which uses a subreport. When I run the report, I get
"Enter Parameter Value" error message for "tblGuestRoom". I click ok
and the report seems to work fine.

I narrowed down this error to the Link Master Fields property setting,
when I tried the same scenario with form/subform. It gave me error:
'The Link Master fields property setting has produced this error: The
object doesn't contain the Automation object 'tblGuestRoom'. Error
happened when I clicked 'next record' while viewing what should have
been the last row for subreport's RecordSource table where key matched
main report's current record (see below).

Here is the picture of how things are set up:
--Main report is "rptReport1". RecordSource is "qryQuery1", which uses
2 tables: tblGuestRoom, the table coming up in the error, and
tblBathroom. They both have primary key of RoomNumber.
--Subreport is "rsubReport1", with RecordSource tblWindow.
TblGuestRoom to tblWindow is a one-to-many relationship, on key
RoomNumber. I think the problem lies with not defining the
relationship from main report to subreport correctly (I am relatively
new to Access, but a programmer). Perhaps I didn't set my
relationships up correctly, or Link Master, or it doesn't know the
one-to-many relationship?? (although seems to be displaying fine).
--On the main report, properties for subreport are as follows:
SourceObject = the subreport. Link Child Fields =tblWindow.RoomNumber,
and Link Master Fields = tblGuestRoom.RoomNumber. In Relationships,
there is a 1 to many relationship between tblGuestRoom and tblWindow.
Does the subreport know this, or do I need to tell it that somehow?
Where do I tell it this? I suspect that this is where my problem lies.
The strange thing is, report data looks correct.

Thank you in advance for any help,
Lori

Nov 13 '05 #2
Hi Larry,

I'm not sure if this is what you meant, but I changed the RecordSource
of my subreport from a table (which had the RoomNumber field) to a
query, where I included all fields except the RoomNumber. This
worked!!!!!!! Thank you soooo much - many hours trying to figure this
one out.

But it did sound like you meant the main report's RecordSource Query. I
did delete one of the tables, leaving just one RoomNumber in the Main
Report, but still got the problem with the subreport (when recordsource
was still a table). Is that what you meant?

I am surprised I had to do this... so if I ever add fields to my table,
then I will always have to update the query to reflect the new fields?

Thank you once again...
Lori

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3
Hi again Larry,

I just tried again, doing exactly what you said. I changed just the
RecordSource Query of the main report, and took out the 2nd Room Number.
This worked BEAUTIFULLY!!!! I didn't have to change the subreport at
all!!!

Thank you very much!

Lori

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #4

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

Similar topics

0
by: JRT | last post by:
Have a Report with sub report that shows up ok in print preview - looks like it should in preview When I print I get the error "this function is too complex", ok or help and on ok it prints out...
2
by: cymichaelip | last post by:
HI I have a report with a subreport, output like below Report: Subreport: Label 1 FirstData1 SecondData1 ThirdData1 Label 2 FirstData2 SecondData2 ThirdData2...
5
by: PeterHardy | last post by:
Hi I'm having a problem removing the title from a subreport. The report is built into a main report but every time you run it there is a title that appears which is the name of the subreport. I...
3
by: tod4 | last post by:
Hi I have a report with 3 subreports where from I take a few value in VBA On Print event. Some value causes error so i wrote in my procedure such code: On Error GoTo err_bl err_bl: If Err =...
2
by: Henrootje | last post by:
I have a report concerning a customer. In this report we find four subreports. They are in layout identical but data comes from different tabel. Now on the main report I count the totals of each...
2
by: Jimmy | last post by:
On the subreport, records are grouped by WorkDate. In the WorkDate header there is a textbox named DateCounter with the control source =1 and running sum set to yes. In either the report footer or...
3
by: Wayne | last post by:
I have a report containing 2 subreports. The subreports each contain a chart. The whole thing easily fits on one page but a second blank page is consistently being generated. This has nothing...
1
by: princesteveis | last post by:
Actually I want a single report by the name "Sales and Purchases Summary Statement" which comprises of a main report name "Purchases" and a subreport name "Sales". I have also created a query...
4
by: Bill | last post by:
I have a command button that opens the a report. On the report the bulk of the information is in the sub report. I have a check box on the form that if isn't check will cause a field to be...
6
by: Kevin | last post by:
On some records, the calculation is correct but on others it is wrong, why? the calculation is as follows (the source of each part of the calculation is below it): txtActualWage =\ ...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.