PDA

View Full Version : query field not found.


ABC123

Romy Huang
01-20-2005, 05:44 AM
Hi

I try to develop OnFetch event when I get next record. I want to check this custom have unpay invoice. There is error "qry = tbl.query_create() no such field". Please help. Thanks in advance.

code below:
=======================================
tbl=table.current(1)
query.description = "Keep Last Invoice"
Query.filter="topparent:CUST_NO.text=CUST_NO .and. OVERDUE"1.0"
Query.order="SHIPDATE"
Query.option="M"
qry = tbl.query_create()

nrecs = qry.records_get()
IF (nrecs " 0) then
tbl.fetch_first()
topparent:K_INVNO.value=tbl.invoice_no
topparent:K_BALANCE.value=tbl.overdue
topparent:K_SDATE.value=tbl.shipdate
topparent.commit()
end if

Bill Warner
01-20-2005, 12:01 PM
First of all, you shouldn't have TOPPARENT in the query filter. This query is using table mode, so all you need is the field name:

Query.filter="CUST_NO=CUST_NO .and. OVERDUE"1.0"

However, this is confusing - CUST_NO=CUST_NO will always be true, so why do you have it in there? Is one of them meant to be a variable (if so, preface it with var-":

Query.filter="CUST_NO=var-"CUST_NO .and. OVERDUE"1.0"

This means that you have to define var-"CUST_NO somewhere.

If this is not your intent, I'm not sure what you are trying to do.

Romy Huang
01-20-2005, 12:42 PM
Thank you. Yes it is what I want.