Hello to everyone.
I had a custom routine written for me back in 2010 that has worked flawlessly since it was written...until I tried to upgrade to the latest v10.5 build. I have also loaded the database on my v11 system and it fails there also. Interestingly, it fails to display the contents of a query in form view, but it does display the query in form design mode.
I have included the code below and would greatly appreciate it if anyone spots something obvious that is causing the failure.
dim tbl as p
dim b_tbl as p
dim qry as p
dim qrecs as n
dim b_tbl as p
dim b_id as n =1
dim holdtbl as c
b_tbl=table.open("billings") 'zap the billings table to keep the procedure clean
b_tbl.zap(.t.)
b_tbl.zap(.t.)
b_tbl.close()
tbl=table.open("contracts") 'open the contracts table
'this line will filter the query to return only ACTV=true On_hold=false CR_updates = true and cur_bal_hors <= to e_hours
query.filter="actv=.t. .and. on_hold=.f. .and. cr_updates=.t. .and. cur_bal_hrs <="+s_quote(parentform:e_hours.value)
query.order="client_name" 'order the resultant query by Client_name
query.options="T" 'make this a temporary query
qry=tbl.query_create() 'create the query
qrecs=qry.records_get() 'get the number of records in the query
if qrecs=0 then ' if it is zero no record met the criteria - give msg stating that then zap the table to start over
msgbox("Alert","No Records Met Your Criteria",UI_STOP_SYMBOL)
b_tbl=table.open("billings")
b_tbl.zap(.t.)
b_tbl.close()
parentform:browse1.resynch()
end
end if
tbl.fetch_first() 'if there are records in the query open the billings table and empty it b_tbl=table.open("billings")
b_tbl.zap(.t.)
b_tbl.close()
b_tbl=table.current(2)
'since this form was based on a set with billings_cc as the parent and billings as the child
'open the billings table as the second table in the set
b_tbl.batch_begin()
'start a batch to populate the billings table based on the filter
WHILE .NOT. tbl.fetch_eof()
b_tbl.enter_begin(.T.)
b_tbl.contract_id=tbl.contract_id
b_tbl.client_id=tbl.client_id
b_tbl.client_name=tbl.client_name
b_tbl.cur_bal_hrs=tbl.cur_bal_hrs
b_tbl.contract_rate=tbl.billable_rate
'b_tbl.p_date=date() 'This is now in the field rules for p_date but it's being updated here anyway
b_tbl.emp_id=parentform:emp_id.value
b_tbl.employee=parentform:employee.value
b_tbl.old_bal_hrs=parentform:e_hours.value
b_tbl.bill_now=.t.
b_tbl.enter_end(.T.)
b_id=b_id+1
tbl.fetch_next()
end while
b_tbl.batch_end()
'the next lines drop the query, close the contract table -
'the rest of the code is force refreshing of the
'of the browse that contains the new records in the billing table.
qry.drop()
tbl.close()
ui_yield()
sys_send_keys("{^home}")
credits_checker:browse1.refresh()
credits_checker:browse1.activate()
parentform.commit()
credits_checker:browse1.Resynch("billings")
sys_send_keys("{F5}")
parentform.Refresh_Layout()
END
Thank you.
Tom
I had a custom routine written for me back in 2010 that has worked flawlessly since it was written...until I tried to upgrade to the latest v10.5 build. I have also loaded the database on my v11 system and it fails there also. Interestingly, it fails to display the contents of a query in form view, but it does display the query in form design mode.
I have included the code below and would greatly appreciate it if anyone spots something obvious that is causing the failure.
dim tbl as p
dim b_tbl as p
dim qry as p
dim qrecs as n
dim b_tbl as p
dim b_id as n =1
dim holdtbl as c
b_tbl=table.open("billings") 'zap the billings table to keep the procedure clean
b_tbl.zap(.t.)
b_tbl.zap(.t.)
b_tbl.close()
tbl=table.open("contracts") 'open the contracts table
'this line will filter the query to return only ACTV=true On_hold=false CR_updates = true and cur_bal_hors <= to e_hours
query.filter="actv=.t. .and. on_hold=.f. .and. cr_updates=.t. .and. cur_bal_hrs <="+s_quote(parentform:e_hours.value)
query.order="client_name" 'order the resultant query by Client_name
query.options="T" 'make this a temporary query
qry=tbl.query_create() 'create the query
qrecs=qry.records_get() 'get the number of records in the query
if qrecs=0 then ' if it is zero no record met the criteria - give msg stating that then zap the table to start over
msgbox("Alert","No Records Met Your Criteria",UI_STOP_SYMBOL)
b_tbl=table.open("billings")
b_tbl.zap(.t.)
b_tbl.close()
parentform:browse1.resynch()
end
end if
tbl.fetch_first() 'if there are records in the query open the billings table and empty it b_tbl=table.open("billings")
b_tbl.zap(.t.)
b_tbl.close()
b_tbl=table.current(2)
'since this form was based on a set with billings_cc as the parent and billings as the child
'open the billings table as the second table in the set
b_tbl.batch_begin()
'start a batch to populate the billings table based on the filter
WHILE .NOT. tbl.fetch_eof()
b_tbl.enter_begin(.T.)
b_tbl.contract_id=tbl.contract_id
b_tbl.client_id=tbl.client_id
b_tbl.client_name=tbl.client_name
b_tbl.cur_bal_hrs=tbl.cur_bal_hrs
b_tbl.contract_rate=tbl.billable_rate
'b_tbl.p_date=date() 'This is now in the field rules for p_date but it's being updated here anyway
b_tbl.emp_id=parentform:emp_id.value
b_tbl.employee=parentform:employee.value
b_tbl.old_bal_hrs=parentform:e_hours.value
b_tbl.bill_now=.t.
b_tbl.enter_end(.T.)
b_id=b_id+1
tbl.fetch_next()
end while
b_tbl.batch_end()
'the next lines drop the query, close the contract table -
'the rest of the code is force refreshing of the
'of the browse that contains the new records in the billing table.
qry.drop()
tbl.close()
ui_yield()
sys_send_keys("{^home}")
credits_checker:browse1.refresh()
credits_checker:browse1.activate()
parentform.commit()
credits_checker:browse1.Resynch("billings")
sys_send_keys("{F5}")
parentform.Refresh_Layout()
END
Thank you.
Tom
Comment