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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detail Table Problem in Report

Status
Not open for further replies.

asm338s

Programmer
Jul 16, 2001
135
US
I have a pretty typical report that uses 2 tables. The top and bottom info comes from a table1 and the detail infor comes from table2 that has multiple entries for every key value in table1. I have both the tables in the database. When I run the report the first time with a selected date range it works fine, but when I try to run it for the second time with a different date range without closing the entire program the detail information in the middle that comes from table2 doesn't show up. When I close the program and open it and run the report then it works.
Any Suggestions?
 
Could you clear that a little bit. Following is the code that I use for this:

Select abc from table xyz into table3
If not used('table2')
Select 777
Use table2 excl
Pack
Zap
Append from table3
Goto top
Endif

Select table1

If (reccount()=0)
Messagebox("No charges located")
Else
Report form 123.frx preview
Endif

Use in table1
 
Unless table2 gets closed somewhere else in your code it will remain "used", and so the code following

If not used('table2')

will only be executed the 1st time through.

Jim

 
Ok I figured out thats not the problem. The problem is somewhere before this code. Its a problem with append.
I use this:

Select * from x into table serv1
select * from y into table serv2

if used('allserv')
select allserv
use in allserv
endif

use allserv excl
zap
append from serv1
append from serv2
goto top

This code works for the first time but for the second time through I still have the data from the first time. The append and zap stuff doesn't work.
 
Unless tables x and y have changed in the interim, I would expect the same result each time.

Jim
 
The values in tables serv1 and serv2 change based on user selection. Its just the zap and append for allserv is not working correctly.
 
I personally have never had or heard of a problem with ZAP. My guess is that the command is only being executed on the first pass.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top