I get an error "Invalid query specified" when I try and retrieve the output from a previous query that I have successfully run. And I don't know why. Can anyone help?
The following code above the dotted line is what I have used to create and run the query. The code below the dotted line is what I have used to retrieve the output of the query. But I get the error "Invalid query specified" when A5 runs the line 'indx = tbl.query_primary_put("MyQuery01")'. The query doesn't appear to exist anymore or A5 can't find it.
Can anyone help please? I want to be able to use the result of the query in this later process.
[PS: The code below the dotted line is taken from the A5 documentation for <TBL>.QUERY_PRIMARY_PUT() ]
The following code above the dotted line is what I have used to create and run the query. The code below the dotted line is what I have used to retrieve the output of the query. But I get the error "Invalid query specified" when A5 runs the line 'indx = tbl.query_primary_put("MyQuery01")'. The query doesn't appear to exist anymore or A5 can't find it.
Can anyone help please? I want to be able to use the result of the query in this later process.
[PS: The code below the dotted line is taken from the A5 documentation for <TBL>.QUERY_PRIMARY_PUT() ]
Code:
Dim NCustIn as P Dim pQry as P ' NCustIn = table.open("NCompany") query.description = "MyQuery01" query.order = "Compid" query.filter = "Compid > 0 .and. Compid < 1000" query.options = "MX" ' pQry = NCustIn.query_create() nQueryRecs = PQry.records_get() ui_msg_box("Query result", "Number of records selected: " + ltrim(str(nQueryRecs,8,0))) NCustIn.close() '-------------------------------------------------------------------- dim tbl as P dim indx as P tbl = table.open("NCompany") indx = tbl.query_primary_put("MyQuery01") rec_count = indx.records_get() ui_msg_box("Query retrieve", "Number of records selected:" + ltrim(str(rec_count,8,0)))
Comment