473,790 Members | 2,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display a recordset in a (sub)report in access??

65 New Member
Hi,

I'm building an aplication and I need to display some fields from a recordset. When try this I only get the last one. I know this has to do with th orde of my code but I don't know how to fix it.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Dim rst As DAO.Recordset
  3.  
  4.     Dim lengte As Integer
  5.     Dim scoreL As Integer
  6.     Dim gewicht As Integer
  7.     Dim scoreW As Integer
  8.     Dim BMI As Integer
  9.     Dim IBW As Integer
  10.  
  11.     Set db = CurrentDb
  12.     Set rst = db.OpenRecordset("SELECT * FROM patParameters WHERE eadnr = " & Form_Testinvoer.eadnr & ";")
  13.  
  14.     volnaam.Caption = Form_Testinvoer.pat & " " & Form_Testinvoer.vpat
  15.     gebDat.Caption = Form_Testinvoer.gebDate
  16.  
  17.     Do Until rst.EOF
  18.         datum = rst.Fields(2)
  19.         leeftijd = age(Form_Testinvoer.gebDate, datum)
  20.         'DoCmd.OpenReport "ZscoreRec", acViewPreview
  21.         rst.MoveNext
  22.     Loop
  23. End Sub
This code is to display the main report that gets its data from a form. In this report I have to display a new recordset (rst). For some reason (probably pure logic) it only displays the last row of the recordset.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2.     Me.data.Caption = Report_Zscores.datum
  3.     Me.age.Caption = Report_Zscores.leeftijd
  4. End Sub
This to fill the fields in the subreport.

Any help would be usefull

Thanx in advance

Twanne
Jul 18 '07 #1
2 2726
nico5038
3,080 Recognized Expert Specialist
For reports you can use the subreport to get "linked" data.
When adding a subform the wizard will propose a link field, just accept that will be sufficient in general.
Your recordset processing loop will indeed loop through all rows and the final one will be the one displayed. For multiple fields you would also need multiple controls on the report....

Nic;o)
Aug 1 '07 #2
Twanne
65 New Member
Thanx

But I already solved this problem. Probably some way you said ;)

Greetz
Twanne
Aug 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2640
by: Becky | last post by:
Hi: I have a main report that calls a sub-report which contains several pages of data. One of the column headings in my sub-report is called "Funds". If several records contain the same Fund Name then only the Fund Name of the first record is printed. If the Fund Name changes, then only the New Fund Name of the first record is printed and so on. I put the codes to do this in the Fund Name Header section of the sub-report. But now,...
0
2051
by: Becky | last post by:
Hi All: I know how to call up a Sub-Report in a Main Report by using VB codes. It goes something like this ... With acc .DoCmd.OpenReport "reportMain", acViewDesign, "", "" acc.Reports!reportMain.reportMain_Section1.SourceObject = "subReportName" .DoCmd.Close acReport, "reportMain", acSaveYes
2
5937
by: Simone | last post by:
Hello. I am using the code below: ------------------------------------------- Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If Me.Section(0).BackColor = vbWhite Then Me.Section(0).BackColor = 15724527 Else Me.Section(0).BackColor = vbWhite End If
14
10632
by: Scott Gorman | last post by:
I have a report with a sub report for an income / expense report for church. My expense report is the sub report. My question is, when I run the report, it prompts me 2-3 times for the parameters of the expense report. Is there a way around this annoyance? Thank you for your help. Scott *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
3
5153
by: Pecanfan | last post by:
Hi, I've got an access report which contains a sub-report. The sub-report contains various items in a group Footer which culminates in a running sum text box called txtGrandTotal. I want to use this 'total' in the main report so I have a text box with the following:- =(!!.!) For some reason, which I'm sure is perfectly obvious but I'm buggered if I
1
2248
by: joan.edington | last post by:
Hi, I have a report that includes some common data followed by a subreport which is made up of a tab control with 3 pages of different lengths, each displaying different information depending on a code in the input record. Ideally I would like each to be printed to its correct length. However, each one prints to the length of the longest page which leaves an ugly gap in the report.
2
2868
by: Simon | last post by:
Dear reader, How to start the event "Activate" in a report as the report is a sub report. By opening the main report the event "Activate" in the sub report is not actived.. Thanks for any help. Regards, Simon
1
1773
by: davidreid | last post by:
Hi, I created 2 seperate Crystal reports and each report performs its own calculations. However, I need to multiply the output of Report 1 with the output of Report 2. I created a new Crystal report and inserted Report 1 and Report 2 as sub-report 1 and sub-report 2 in my new Crystal report. The output of both sub-report 1 and sub-report 2 are numeric. I need to find out how I can multiply the output of sub-report 1 and sub-report 2 so...
9
1965
by: Zaher Rabah | last post by:
Hi, Explain: I have a report for reciept list , it contain 3 sub report. 1st for cash and it contain sub total 1 2nd for check and contain sub total 2 3rd for Credit card and contain sub total 3 and in the main report i put :
11
8025
by: postman | last post by:
In Access 2007, I have a report with a sub-report in the Detail section. The Detail section of the main report has alternating colors for each row displayed. Is there a way to get the sub-report to automatically synchronize its background color with the Detail section in the parent report for each row? Thanks in advance!
0
9666
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
10412
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
10200
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
10142
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
9986
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...
1
7529
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
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
3703
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.