i have been using this code ok but have added an extra filter and am now receiving an error.
i looked through the interactive window and the new added filter is not being found, which could be the cause of the error.
im really stuck here as to how to get the variable to be recognised by this script. the new filter is 'filterclient' which is to be populated with the variable 'v_caseref' which takes its value from a field on an open form where the script was initiated. The field is character.
any help apreciated. thanks
i looked through the interactive window and the new added filter is not being found, which could be the cause of the error.
im really stuck here as to how to get the variable to be recognised by this script. the new filter is 'filterclient' which is to be populated with the variable 'v_caseref' which takes its value from a field on an open form where the script was initiated. The field is character.
Code:
dim tbl as P dim duptbl as P dim qry as P dim nrecs as N dim i as N dim GLOBAL vPayRecId as c dim v_caseref as c vcaseref= alltrim(debt_payment_made->caseref) tbl = table.current() duptbl = table.open("debt_payment_made") filter_master = "payment_master = .T." filterclient= v_caseref filter_recs = "("+filter_master +") .and. ("+filterclient +")" query.description = "Dup Recs" query.order = "" query.filter = filter_recs query.options = "" qry = tbl.query_create() nrecs = qry.records_get() if nrecs=0 then ui_msg_box("No Records", "No records to update") end else ui_msg_box("Process Payments", (nrecs + " " + "Records will be updated")) tbl.fetch_first() while .NOT. tbl.fetch_eof() duptbl.enter_begin() duptbl.Caseref=tbl.caseref duptbl.Debt_id=tbl.debt_id duptbl.Client=tbl.client duptbl.Date_paid=date() duptbl.Amt_paid=tbl.Amt_paid duptbl.Lender=tbl.lender duptbl.Payment_id=vPayRecId duptbl.Payment_master=.F. duptbl.enter_end() tbl.fetch_next() end while 'tbl.close() duptbl.close() qry.close() topparent.Commit() topparent.Resynch() topparent.Refresh_Layout() parentform.close(.f.) ui_msg_box("Payment Processing", (nrecs + " " + "Creditor Records have been updated.")) parentform.close(.f.) end if
Comment