Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help!!My report is only showing the last record

Status
Not open for further replies.

Regdod

Programmer
Feb 10, 2003
5
US
I am trying to build a report that gets info from one table to get a ID number and then looks at another table to get totals, and then looks at a third to get info to calculate using the totals from table 2. I have built the nested If then else statements and when I step through the code it starts at the first ID number and processes on through to the last, however when I open the report in print preview it only shows the very last record. How do I get the report to show all records with each record on a new line. Thanks very much for your help
 
Regdod:

Not quite sure what you've done to create the report. I'm having a bit of trouble with the building the if then else statements.

If you are using code to create the data, the code must keep looping thru, calculating results and placing them in the appropriate controls. However, nothing is printed out until the code finishes executing. So when the code ends, the last record is what is left, and that is why your report only shows the last record.

If you don't already, you should have a query on which the report is based. You build the recordset in the query. You can then check the results of the query to see that the number of records you expect are, in fact, there. Then the query, as the Record Source for the report, supplies the data to the appropriate fields.

HTH,

Vic
 
Base the report on a query as suggested. If necessary, base the query on one or more other queries (to accomplish the ID lookup and totals you mention). For totals you probably should use grouping queries.

Build the initial queries to supply the interim data you mention. When they are working correctly, build the final query based on the other queries (and table if appropriate) to create the data source for your report. Then your report should be simple, because at that point the query should have one row of data for each detail row in the report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top