Hi Guys,
The following script copies the previous years data into a new dbf that is named Y+previous year's year. Example in about February 2001, if the script is run, it will copy all data for the year 2000 into a new dbf named Y2000, then delete all 2000 data from the current dbf. Don't pay any attention to 1999_1.dbf, it is merely in the developement stage of this script and will be deleted in the final stage, it is a copy of another years data.
What I need to do is to add a line after a-tbl.index_primary_put("lstfsmid") that will prevent editing when the table is viewed at a later date.
a_tbl = table.open("1999_1.dbf")
new_name = "y"+alltrim(str(year(date()-365)))
query.order = "lastname+firs_nam+midinit"
query.filter = "substr(datepaid,9,2)=substr(new_name,3,2)"
a_tbl.query_create()
copy.set = ""
copy.db = "c:program filesa5v4union"+chr(92)+new_name+".dbf"
copy.dd = .t.
copy.delete_o_dd = .f.
copy.records = .t.
copy.fields = 10
copy.field1 = "lastname"
copy.field2 = "datepaid"
copy.field3 = "duespaid"
copy.field4 = "assesspaid"
copy.field5 = "percent"
copy.field6 = "trade"
copy.field7 = "dues"
copy.field8 = "firs_nam"
copy.field9 = "midinit" '20
copy.field10 = "dept_num"
a_tbl.copy()
file_add_to_db("c:program filesa5v4union"+chr(92)+new_name+".dbf")
query.order = "lastname+firs_nam+midinit"
a_tbl.close()
a_tbl.open("1999_1")
a_tbl.delete_range("substr(dtoc(date()-365),7,4)>=substr(duespaid,7,4)")
a_tbl.close()
a_tbl=table.open(alltrim(new_name)+".dbf")
a_tbl.index_create_begin("lstfstmid","lastname+firs_nam+midinit")
index1=a_tbl.index_create_end()
ui_msg_box("Index","Index has been created.")
'a_tbl.index_get("lstfstmid")
a_tbl.index_primary_put("lstfstmid")
a_tbl.close() 'line 35
end
Any ideas,
Thank you all in advance,
ED
The following script copies the previous years data into a new dbf that is named Y+previous year's year. Example in about February 2001, if the script is run, it will copy all data for the year 2000 into a new dbf named Y2000, then delete all 2000 data from the current dbf. Don't pay any attention to 1999_1.dbf, it is merely in the developement stage of this script and will be deleted in the final stage, it is a copy of another years data.
What I need to do is to add a line after a-tbl.index_primary_put("lstfsmid") that will prevent editing when the table is viewed at a later date.
a_tbl = table.open("1999_1.dbf")
new_name = "y"+alltrim(str(year(date()-365)))
query.order = "lastname+firs_nam+midinit"
query.filter = "substr(datepaid,9,2)=substr(new_name,3,2)"
a_tbl.query_create()
copy.set = ""
copy.db = "c:program filesa5v4union"+chr(92)+new_name+".dbf"
copy.dd = .t.
copy.delete_o_dd = .f.
copy.records = .t.
copy.fields = 10
copy.field1 = "lastname"
copy.field2 = "datepaid"
copy.field3 = "duespaid"
copy.field4 = "assesspaid"
copy.field5 = "percent"
copy.field6 = "trade"
copy.field7 = "dues"
copy.field8 = "firs_nam"
copy.field9 = "midinit" '20
copy.field10 = "dept_num"
a_tbl.copy()
file_add_to_db("c:program filesa5v4union"+chr(92)+new_name+".dbf")
query.order = "lastname+firs_nam+midinit"
a_tbl.close()
a_tbl.open("1999_1")
a_tbl.delete_range("substr(dtoc(date()-365),7,4)>=substr(duespaid,7,4)")
a_tbl.close()
a_tbl=table.open(alltrim(new_name)+".dbf")
a_tbl.index_create_begin("lstfstmid","lastname+firs_nam+midinit")
index1=a_tbl.index_create_end()
ui_msg_box("Index","Index has been created.")
'a_tbl.index_get("lstfstmid")
a_tbl.index_primary_put("lstfstmid")
a_tbl.close() 'line 35
end
Any ideas,
Thank you all in advance,
ED
Comment