Report Form Behavior problem
Report Form Behavior problem
A few months ago I created a report for one of my tables (it's expense report, some may remember when I worked through this). It was all working fine, and suddenly I started to get a message when trying to run it saying "expenseid_a is not a field" (paraphrasing, I don't remember the exact error now, and I have changed it, which I'll get to in a minute).
My understanding of the report form is, wherever it is called from (whatever procedure) any fields/variable that exist in that scope are visible to the report.
I was doing a query to a cursor, and that data was driving the report. But then it stopped finding one of the fields.
So I decided to switch it to a table. (This also has the advantage of being able to test it easier at the report form time).
The problem with query to table is, VFP treats it as a freetable and only allows 10 character field names. So I did the query, found all the field names, mapped them back properly to the report form, and when I run it now, I am past the "expenseid_a" issue, and the table populates correctly, BUT my detail band now just shows the same (first) record over and over for the number of records in the table. I don't recall making a change to the report other than the field mappings, and data grouping (It used to be EXPENSEID_A, now I have it set to expenseprint.expenseid2 which is the "new" field mapping of the old ExpenseID_A).
I've been tearing my hair out, and I just can't seem to figure it out. A second report runs right after it against the same data set which prints receipts, and that one works fine...
The code to launch the report is here:
SET SAFETY OFF SELECT * FROM EXPENSE; LEFT JOIN EXPENSEDETAIL ON EXPENSEDETAIL.EXPENSEID = EXPENSE.EXPENSEID; WHERE EXPENSE.EXPENSEID = EXPENSEGRID.EXPENSEID INTO TABLE EXPENSEPRINT ORDER BY EXPENSEDETAILDATE READWRITE SET SAFETY ON * SELECT EXPENSEPRINT GO TOP * M.lnCorporateTotal = ThisForm.pageframebase1.pageBASE1.lblCorporateTotal.Caption IF RIGHT(ALLTRIM(M.lnCorporateTotal),2) = "¥0" M.lnCorporateTotal = "" ELSE M.lnCorporateTotal = RIGHT(lnCorporateTotal,LEN(lnCorporateTotal)-AT(":",lnCorporateTotal)) ENDIF * M.lnTransportTotal = ThisForm.pageframebase1.pAGEBASE1.lbltransportationTotal.Caption IF RIGHT(ALLTRIM(M.lnTransportTotal),2) = "¥0" M.lnTransportTotal = "" ELSE M.lnTransportTotal = RIGHT(lnTransportTotal,LEN(lnTransportTotal)-AT(":",lnTransportTotal)) ENDIF * M.lnTNETotal = ThisForm.Pageframebase1.PAGEBASE1.lblTNETotal.Caption IF RIGHT(ALLTRIM(M.lnTNETotal),2) = "¥0" M.lnTNETotal = "" ELSE M.lnTNETotal = RIGHT(lnTNETotal,LEN(lnTNETotal)-AT(":",lnTNETotal)) ENDIF * M.lnTradeToolsTotal = ThisForm.Pageframebase1.PAGEBASE1.lblTradeToolsTotal.Caption IF RIGHT(ALLTRIM(M.lnTradeToolsTotal),2) = "¥0" M.lnTradeToolsTotal = "" ELSE M.lnTradeToolsTotal = RIGHT(lnTradeToolsTotal,LEN(lnTradeToolsTotal)-AT(":",lnTradeToolsTotal)) ENDIF * M.lnOtherTotal = ThisForm.Pageframebase1.PAGEBASE1.lblOtherTotal.Caption IF RIGHT(ALLTRIM(M.lnOtherTotal),1) = ":" M.lnOtherTotal = "" ELSE M.lnOtherTotal =RIGHT(lnOtherTotal,LEN(lnOtherTotal)-AT(":",lnOtherTotal)) ENDIF * M.lnExpenseTotal = ThisForm.pageframebase1.pageBASE1.lblExpenseTotal.Caption M.lnExpenseTotal = RIGHT(lnExpenseTotal,LEN(lnExpenseTotal)-AT(":",lnExpenseTotal)) * SELECT EXPENSEPRINT REPORT FORM EXPENSEREPORT.FRX TO PRINTER * SELECT EXPENSEPRINT DELETE ALL FOR EMPTY(EXPENSEPRINT.EXPENSEREC) LABEL FORM EXPENSERECEIPTS.LBX TO PRINTER * SELECT EXPENSEPRINT USE
I don't think any of this is an issue, but provided in case I'm doing something stupid.
Any ideas why this same record prints over and over until the detail band has printed the same number of records as is in the table that is its source data?
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS
"I try to be nice, but sometimes my mouth doesn't cooperate."