Hi, I'm having a problem with a script I'm putting together and not quite sure why. The first part of the script is a query that produces one record only. Great so far. The next part of the script should export 4 fields from the result of the preceding query. When I run the query and export, the query is working fine. I have opened the table "Clients", and the appropriate record is displayed. When the export runs, it not only displays all "Clients", but it also displays a record for each corresponding result in the parent table, even though the parent table is not open. Instead of having an export showing one record with four fields in it, it will max out the excel program at just over 16,000 records. Ultimately what I want to accomplish is have the export based on the preceding query which only has one record. Below is the code. For all intents and purposes, it should be working. I'm not sure whether it has to do with the table "Clients" being a child table of "ameregl3" or not. There are other parts of the script that are currently commented out as I work with sections of a script until I have a fully functioning script. Hope this all makes sense.
dim user1 as C
dim user2 as C
dim tbl as P
dim a_tbl as P
tstr1 = ui_get_text("Client Name","Please Enter Client")
if tstr1=""then
end
end if
user1=(tstr1)
'tstr2 = ui_get_text("Reference Number","Please Enter the Reference Number")
'if tstr1=""then
' end
'end if
'user2=(tstr2)
'DEBUG(1)
tbl=table.open("clients")
query.description = ""
query.order = "ATTORNEY"
query.filter = "ATTORNEY=(user1)"
query.options = "I"
tbl.query_create()
tbl = table.current()
export.type = 4
export.names = .F.
export.file = "C:\Others_billing.xls"
export.options = ""
export.field_sep = ""
export.record_sep = ""
export.fields = 4
export.field1 = "clients->attorney"
export.field2 = "clients->name"
export.field3 = "clients->address"
export.field4 = "clients->city_state_zip"
tbl.export()
'tbl=table.open("ameregl3")
'query.description = ""
'query.order = ""
'query.filter = "REF___=(user2)"
'query.options = "I"
'tbl.query_create()
'tbl = table.current()
'export.type = 4
'export.names = .F.
'export.file = "C:\Others_billing2.xls"
'export.options = ""
'export.field_sep = ""
'export.record_sep = ""
'export.fields = 4
'export.field1 = "ameregl3->date_comp"
'export.field2 = "ameregl3->person"
'export.field3 = "ameregl3->ref___"
'export.field4 = "ameregl3->fee"
'tbl.export()
dim user1 as C
dim user2 as C
dim tbl as P
dim a_tbl as P
tstr1 = ui_get_text("Client Name","Please Enter Client")
if tstr1=""then
end
end if
user1=(tstr1)
'tstr2 = ui_get_text("Reference Number","Please Enter the Reference Number")
'if tstr1=""then
' end
'end if
'user2=(tstr2)
'DEBUG(1)
tbl=table.open("clients")
query.description = ""
query.order = "ATTORNEY"
query.filter = "ATTORNEY=(user1)"
query.options = "I"
tbl.query_create()
tbl = table.current()
export.type = 4
export.names = .F.
export.file = "C:\Others_billing.xls"
export.options = ""
export.field_sep = ""
export.record_sep = ""
export.fields = 4
export.field1 = "clients->attorney"
export.field2 = "clients->name"
export.field3 = "clients->address"
export.field4 = "clients->city_state_zip"
tbl.export()
'tbl=table.open("ameregl3")
'query.description = ""
'query.order = ""
'query.filter = "REF___=(user2)"
'query.options = "I"
'tbl.query_create()
'tbl = table.current()
'export.type = 4
'export.names = .F.
'export.file = "C:\Others_billing2.xls"
'export.options = ""
'export.field_sep = ""
'export.record_sep = ""
'export.fields = 4
'export.field1 = "ameregl3->date_comp"
'export.field2 = "ameregl3->person"
'export.field3 = "ameregl3->ref___"
'export.field4 = "ameregl3->fee"
'tbl.export()
Comment