Hi Phorum,
I guess you folks are tired of seeing this one and I'm
tired of trying to make it work, but here goes. The early part of this script creates a table whose name is 1 year less than the current year and adds it to the DB. All is fine there, now I need an index of lastname+firs_nam+midinit. Nothing is really simple here
this will have to work once a year every year hereafter, hence; the table to be opened for creating the index must
be a variable, like new_name or similar. The Professional Edition Reference book that I have is not very clear on
this.
What I need to know is what changes do I need in the commented out lines of the following script:
a_tbl = table.open("1999_1.dbf")
new_name = 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 = .f.
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" '20
copy.field9 = "midinit"
copy.field10 = "dept_num"
a_tbl.copy()
file_add_to_db("c:program filesa5v4union"+chr(92)+new_name+".dbf")
a_tbl.close()
'a_tbl.open("new_name.dbf")
'table.index_create_begin("lastname", "lastname")
'index_add("firs_nam", "firs_nam")
'index_add("midinit", "midinit")
'index1 = tbl.index_create_end()
'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()
Where I open the table (presumingly 1999.dbf in this case)
I have tried "1999.dbf", "new_name", and "alltrim(str(year(date()-365)))"
It always says it can't find the table.
Thank you all for reading,
ED
I guess you folks are tired of seeing this one and I'm
tired of trying to make it work, but here goes. The early part of this script creates a table whose name is 1 year less than the current year and adds it to the DB. All is fine there, now I need an index of lastname+firs_nam+midinit. Nothing is really simple here
this will have to work once a year every year hereafter, hence; the table to be opened for creating the index must
be a variable, like new_name or similar. The Professional Edition Reference book that I have is not very clear on
this.
What I need to know is what changes do I need in the commented out lines of the following script:
a_tbl = table.open("1999_1.dbf")
new_name = 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 = .f.
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" '20
copy.field9 = "midinit"
copy.field10 = "dept_num"
a_tbl.copy()
file_add_to_db("c:program filesa5v4union"+chr(92)+new_name+".dbf")
a_tbl.close()
'a_tbl.open("new_name.dbf")
'table.index_create_begin("lastname", "lastname")
'index_add("firs_nam", "firs_nam")
'index_add("midinit", "midinit")
'index1 = tbl.index_create_end()
'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()
Where I open the table (presumingly 1999.dbf in this case)
I have tried "1999.dbf", "new_name", and "alltrim(str(year(date()-365)))"
It always says it can't find the table.
Thank you all for reading,
ED
Comment