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

Excel import file and OnFirstRecord

Status
Not open for further replies.

sasi3dev

Programmer
Nov 20, 2001
3
US
Hi

I have a VB program that uses Crystal Reports 8.0 to generate a report and then create an Excel file using the .Export option. A second report (still in the same program) reads the Excel file and print another report. It is sometimes necessary for the end user to edit the Excel spreadsheet between the creation and the printing of the second report. My problem is that if the spreadsheet is modified between runs, the report does not print a formula field for just the first sorted record of the report. All other lines in the report print fine. If the Excel file is not modified between runs the report prints properly. What I end up with if the Excel file has been modified is the 2nd thru last of the sales rank.

Here is the code in the formula field.

if OnFirstRecord Then
NumberVar salesCount := 1;

if OnFirstRecord Then
NumberVar rankValue := 0;

if {ado_excel.value} <> Previous ({ado_excel.value}) Then
rankValue := 0;

if {ado_excel.value} <> Previous ({ado_excel.value}) Then
salesCount := 0;

if {ado_excel.Total sales} = Previous ({ado_excel.Total sales}) Then
rankValue := rankValue - 1;

if {ado_excel.Total sales} < Previous ({ado_excel.Total sales}) Then
rankValue := salesCount;

salesCount := salesCount + 1;
rankValue := rankValue + 1;

rankValue is what is printed on the second report.

Any ideas?

Thanks for any help.

sasi3dev.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top