I have a form here based on a set (picture: set worksheet). When I initially open the form it displays the proper data. I have a button that says " calculate totals" which simply moves the values of calculated fields into the parent table fields to store the total values. However, when i run this script using the the new build of V10 some strange things have begun to happen....The last record of the child record in the form randomly and unexplainably changes! This has been very frustrating and difficult to resolve. However, after the record changes, if i click on the embedded browse the value will change back to the initial value. The same unexplained action occurs on any embedded browse on the form.
I the script that runs on the button is below and pictures are attached of what is happening.
I the script that runs on the button is below and pictures are attached of what is happening.
Code:
'Date Created: 20-Jan-2009 04:34:37 PM 'Last Updated: 11-Jan-2010 11:57:39 PM 'Created By : Lee Goldberg 'Updated By : Lee DIM vTotCost as n DIM vTotBill as n DIM vTotPaid as n DIM tbl as p DIm vMode as l DIM vWO as c DIM vType as c DIM vBillTruck as l DIM vBillable as l DIM vfrmMode as c 'vfrmMode = parentform.Mode_Get() 'if vfrmMode = "Enter" .or. vfrmMode = "Change" then ' parentform.Commit() 'end if 'frmWksht.Commit() vType = frmWksht:bill_type.value vType = alltrim(vtype) 'T/F will the truck be billed? vBillTruck = frmWksht:bill_trks.value ' cost of trucks vTotCost = cTot_Trk_cost.value 'parentform.Commit() vWO = frmWksht:wo_num.value 'tbl = table.open("tblwksht") 'tbl.fetch_find(vWO) if left(vtype,1) = "1" then 'if statement for bill type = 1 which is bill items / pay hours vTotBill = cBI_tot.value vTotPaid = cTotal_paid.value else if left(vtype,1) = "2" then 'bill hours / pay hours vTotBill = cTotal_bill_emp.value vTotPaid = cTotal_paid.value else if left(vtype,1) = "3" then 'bill items / pay items vTotBill = cBI_tot.value vTotPaid = cItems_paid.value end if 'if the user wants to bill the use of trucks to the customer then add to total billed if vBillTruck = .t. then frmWksht:total_billed.value = vTotbill + cTot_trk_bill.value else frmWksht:total_billed.value = vTotbill end if vBillable = frmWksht:billable.value if vBillable = .f. then frmWksht:total_billed.value = 0 end if frmWksht:total_paid.value = vTotPaid frmWksht:total_units_paid.value = cpi_tot.value frmWksht:total_cost.value = vTotCost 'tbl.change_begin() 'tbl.Total_billed = vTotBill 'tbl.Total_paid = vTotPaid 'tbl.Total_cost = vTotCost 'tbl.change_end() 'tbl.close() 'parentform:total_billed.Refresh() 'parentform:total_paid.refresh() 'parentform:total_cost.Refresh() 'parentform.refresh_layout()
Comment