write recordset and other info to report through vba

T

Tony Piperato

Greetings,

First, I am sorry for the cross post but this is an emergency.

Can someone please tell me how to write a recordset to the detail area of a
report with vba? I have a module that builds a recordset. This recordset
may have hundreds of records. I need to know how to write each record to a
report detail area. For example, my recordset my have fields such as FName,
LName, Address1, Address2, CustomField1, CustomField2, etc.. Also, I will
be using a for/next loop and will need to write the value of the loop to the
detail area as well, which is in no recordset.

Actual code examples are appreciated.

Regards,

Tony
 
M

Marshall Barton

Tony said:
Can someone please tell me how to write a recordset to the detail area of a
report with vba? I have a module that builds a recordset. This recordset
may have hundreds of records. I need to know how to write each record to a
report detail area. For example, my recordset my have fields such as FName,
LName, Address1, Address2, CustomField1, CustomField2, etc.. Also, I will
be using a for/next loop and will need to write the value of the loop to the
detail area as well, which is in no recordset.


You're lacking a lot of details about how your report is
supposed to work. I took a guess at what you're looking for
in your original thread.
 
T

Tony Piperato

OK, here goes:

1) I have a VERY complicated calculation involving a table.
2) I will run through a for/next loop to represent a 24 hour period (for x
= 1 to 24) and NO I cannot use an outer join with a table that has 24 rows.
3) I need to print the 24 hours down the page of the report along with the
results from my calculation, so the result would look like:

Hour Reading
1 5.76
2 0
3 3.45
etc..

4) I can have more than one day's worth of readings and so will need to
group on date which IS in the table data.

There you are. All I want to know is first; How do I attach the hour data
to a textbox if it is coming from a for/next loop and second; how do I
attach the "reading" data (which is a calculation remember) to the "reading"
textbox on the report.

Hope this clears things up and thanks again for all your help.

Tony
 
M

Marshall Barton

Tony said:
OK, here goes:

1) I have a VERY complicated calculation involving a table.
2) I will run through a for/next loop to represent a 24 hour period (for x
= 1 to 24) and NO I cannot use an outer join with a table that has 24 rows.
3) I need to print the 24 hours down the page of the report along with the
results from my calculation, so the result would look like:

Hour Reading
1 5.76
2 0
3 3.45
etc..

4) I can have more than one day's worth of readings and so will need to
group on date which IS in the table data.

There you are. All I want to know is first; How do I attach the hour data
to a textbox if it is coming from a for/next loop and second; how do I
attach the "reading" data (which is a calculation remember) to the "reading"
textbox on the report.


I can only think of two ways to approach this kind of
situation. One is to have 24 text boxes and assign the
calculated value to each one as you go through the loop.

For intK = 1 To 24
Me("txtHour" & intK) = intK
Me("txtValue" & intK) = calculatedvalue
Next intK

The other way is to use an unbound subreport as I outlined
in your other thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top