I am trying to create a form using code from an Xdialog doing the same job.
I cut-and-pasted the code from the xdialog to a button on my form.
when I load the form and "Click" on the button , I get the following error;
tbl_logging.query_create()
Cannot use function in this context
same with tbl_complete.query_create()
WTF ????????????????????????????????????
Code on the multistate button is
case var->ActionChoice = "Run"
if b_finish < b_start then
message_text = "Error .. Start Value lower than Finish"
else
tbl_Logging = table.open("Logging")
tbl_complete = table.open("Complete_Logging")
tbl_workfile = table.current()
batch_start = ut(batch_pfx)+b_start
batch_finish = ut(batch_pfx)+b_finish
query.filter = "between(origin_id,Var->Batch_start,Var->batch_finish)"+if(CountryChoice="Select",".and.Country="+quote(ut(CountrySelect)),"")
query.order = "origin_id"
tbl_logging.query_create()
query.filter = "between(reg,Var->Batch_start,Var->batch_finish)"+if(CountryChoice="Select",".and.Country="+quote(ut(CountrySelect)),"")
query.order = "reg"
tbl_complete.query_create()
showvar(query.filter)
reggie = batch_start
while (Reggie < batch_finish)
Logging_rec = tbl_Logging.fetch_find(Reggie)
if (Logging_rec < 0) Then
Complete_Rec = tbl_Complete.fetch_find(Reggie)
if (Complete_Rec > 0) then
tbl_workfile.enter_begin()
'blah blah blah
tbl_workfile.enter_end(.t.)
rec_copied = rec_copied + 1
end if
end if
reggie = increment_value(reggie)
end while
tbl_workfile.close()
tbl_Complete.close()
tbl_Logging.close()
Message_text = rec_copied+" Records Copied to WFPL"
rec_copied = 0
end if​
The same code works fine within the Xdialog.
What do I have to change when in a form?
I cut-and-pasted the code from the xdialog to a button on my form.
when I load the form and "Click" on the button , I get the following error;
tbl_logging.query_create()
Cannot use function in this context
same with tbl_complete.query_create()
WTF ????????????????????????????????????
Code on the multistate button is
case var->ActionChoice = "Run"
if b_finish < b_start then
message_text = "Error .. Start Value lower than Finish"
else
tbl_Logging = table.open("Logging")
tbl_complete = table.open("Complete_Logging")
tbl_workfile = table.current()
batch_start = ut(batch_pfx)+b_start
batch_finish = ut(batch_pfx)+b_finish
query.filter = "between(origin_id,Var->Batch_start,Var->batch_finish)"+if(CountryChoice="Select",".and.Country="+quote(ut(CountrySelect)),"")
query.order = "origin_id"
tbl_logging.query_create()
query.filter = "between(reg,Var->Batch_start,Var->batch_finish)"+if(CountryChoice="Select",".and.Country="+quote(ut(CountrySelect)),"")
query.order = "reg"
tbl_complete.query_create()
showvar(query.filter)
reggie = batch_start
while (Reggie < batch_finish)
Logging_rec = tbl_Logging.fetch_find(Reggie)
if (Logging_rec < 0) Then
Complete_Rec = tbl_Complete.fetch_find(Reggie)
if (Complete_Rec > 0) then
tbl_workfile.enter_begin()
'blah blah blah
tbl_workfile.enter_end(.t.)
rec_copied = rec_copied + 1
end if
end if
reggie = increment_value(reggie)
end while
tbl_workfile.close()
tbl_Complete.close()
tbl_Logging.close()
Message_text = rec_copied+" Records Copied to WFPL"
rec_copied = 0
end if​
The same code works fine within the Xdialog.
What do I have to change when in a form?
Comment