473,414 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 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 7372
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 =\ ...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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 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.