473,287 Members | 1,655 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,287 software developers and data experts.

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

65
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 2695
nico5038
3,080 Expert 2GB
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
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
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...
0
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, "", ""...
2
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...
14
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...
3
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...
1
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...
2
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...
1
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...
9
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...
11
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.