The following script works fine when run from code editor, but when I try to run it from a "right_click_menu" attached to a browse on "gns_work_file" it throws up an error "no such table error occured at line 28" the tbl.copy() statement. What am I doing wrong please?
thanks in anticipation
'Date Created: 18-May-2005 05:50:07 PM
'Last Updated: 24-May-2005 04:46:33 PM
'Created By :
'Updated By :
on error goto error_routine
dim tbl as p
tbl = table.open("my airfields", FILE_RW_EXCLUSIVE)
tbl.zap(.t.)
tbl.close()
temporary_table = file.temp_path_get()+"temp_table.dbf"
tbl = table.open("gns_work_file")
query.filter = "left(Dsg,len(\"air\")) = \"air\""
query.order = "recno()"
tbl.query_create()
copy.set = ""
copy.db = temporary_table
copy.dd = .F.
copy.delete_o_dd = .F.
copy.records = .T.
copy.fields = 7
copy.field1 = "GNS_WORK_FILE-"FULL_NAME"
copy.field2 = "GNS_WORK_FILE-"AREA"
copy.field3 = "GNS_WORK_FILE-"ADM1"
copy.field4 = "GNS_WORK_FILE-"DMS_LAT"
copy.field5 = "GNS_WORK_FILE-"DMS_LONG"
copy.field6 = "GNS_WORK_FILE-"DSG"
copy.field7 = "GNS_WORK_FILE-"SORT_NAME"
tbl.copy()
a_tbl = table.open("my airfields")
append.t_db = temporary_table
append.m_key = ""
append.t_key = ""
append.m_filter = ""
append.t_filter = ""
append.type = "All"
append.m_count = 7
append.m_field1 = "Dms_Lat"
append.m_exp1 = "@temp_table-"dms_lat"
append.m_field2 = "Dms_Long"
append.m_exp2 = "@temp_table-"dms_long"
append.m_field3 = "Dsg"
append.m_exp3 = "@temp_table-"dsg"
append.m_field4 = "Adm1"
append.m_exp4 = "@temp_table-"adm1"
append.m_field5 = "Sort_Name"
append.m_exp5 = "@temp_table-"sort_name"
append.m_field6 = "Full_Name"
append.m_exp6 = "@temp_table-"Full_name"
append.m_field7 = "Area"
append.m_exp7 = "@temp_table-"Area"
append.t_count = 0
a_tbl.append()
a_tbl.close()
tbl.close()
end
error_routine:
err_msg = error_text_get(error_code_get())
script = error_script_get()
line = error_line_number_get()
ui_msg_box("Error",err_msg+" error occured at line "+alltrim(str(line,4,0))+" in Script "+alltrim(script))
end
thanks in anticipation
'Date Created: 18-May-2005 05:50:07 PM
'Last Updated: 24-May-2005 04:46:33 PM
'Created By :
'Updated By :
on error goto error_routine
dim tbl as p
tbl = table.open("my airfields", FILE_RW_EXCLUSIVE)
tbl.zap(.t.)
tbl.close()
temporary_table = file.temp_path_get()+"temp_table.dbf"
tbl = table.open("gns_work_file")
query.filter = "left(Dsg,len(\"air\")) = \"air\""
query.order = "recno()"
tbl.query_create()
copy.set = ""
copy.db = temporary_table
copy.dd = .F.
copy.delete_o_dd = .F.
copy.records = .T.
copy.fields = 7
copy.field1 = "GNS_WORK_FILE-"FULL_NAME"
copy.field2 = "GNS_WORK_FILE-"AREA"
copy.field3 = "GNS_WORK_FILE-"ADM1"
copy.field4 = "GNS_WORK_FILE-"DMS_LAT"
copy.field5 = "GNS_WORK_FILE-"DMS_LONG"
copy.field6 = "GNS_WORK_FILE-"DSG"
copy.field7 = "GNS_WORK_FILE-"SORT_NAME"
tbl.copy()
a_tbl = table.open("my airfields")
append.t_db = temporary_table
append.m_key = ""
append.t_key = ""
append.m_filter = ""
append.t_filter = ""
append.type = "All"
append.m_count = 7
append.m_field1 = "Dms_Lat"
append.m_exp1 = "@temp_table-"dms_lat"
append.m_field2 = "Dms_Long"
append.m_exp2 = "@temp_table-"dms_long"
append.m_field3 = "Dsg"
append.m_exp3 = "@temp_table-"dsg"
append.m_field4 = "Adm1"
append.m_exp4 = "@temp_table-"adm1"
append.m_field5 = "Sort_Name"
append.m_exp5 = "@temp_table-"sort_name"
append.m_field6 = "Full_Name"
append.m_exp6 = "@temp_table-"Full_name"
append.m_field7 = "Area"
append.m_exp7 = "@temp_table-"Area"
append.t_count = 0
a_tbl.append()
a_tbl.close()
tbl.close()
end
error_routine:
err_msg = error_text_get(error_code_get())
script = error_script_get()
line = error_line_number_get()
ui_msg_box("Error",err_msg+" error occured at line "+alltrim(str(line,4,0))+" in Script "+alltrim(script))
end
Comment