Hi,
I am trying to create a cursor to show invoices in a grid.
I have a textbox for Customer number and a checkbox for ALL or UNPAID invoices. I tried to put it in an IIF() but couldn't get it to work so I split it up but still don't get what I expected. I guess with all the help I have had, I still don't get the grouping.
Data looks like this:
custno Date invoice# debit credit
200 ----- 10001 500.00
200 ----- 10001 500.00
201 ----- 10002 800.00
201 ----- 10002 200.00
201 ----- 10002 600.00
I thought I could group by the invoice# and compare
debit - credit to see if invoice was paid but I can't get it to work.
Am I wrong about what I should expect here?
Would someone give me a push in the right direction here?
Appreciate your time and any suggestions.
Judi
I am trying to create a cursor to show invoices in a grid.
I have a textbox for Customer number and a checkbox for ALL or UNPAID invoices. I tried to put it in an IIF() but couldn't get it to work so I split it up but still don't get what I expected. I guess with all the help I have had, I still don't get the grouping.
Data looks like this:
custno Date invoice# debit credit
200 ----- 10001 500.00
200 ----- 10001 500.00
201 ----- 10002 800.00
201 ----- 10002 200.00
201 ----- 10002 600.00
I thought I could group by the invoice# and compare
debit - credit to see if invoice was paid but I can't get it to work.
Am I wrong about what I should expect here?
Code:
LOCAL lnchk, lnCustno
lnCustno = VAL(This.Parent.txtCustno.Value)
lnchk = This.Value
This.Parent.grdTicket.RecordSource =""
IF lnchk
SELECT custno, invcnumb, invcdate, invcdesc, invcdebt, invccred, invcwght, invctype ;
FROM ticket ;
ORDER BY Ticket.custno, ticket.invcnumb ;
GROUP BY Ticket.custno, ticket.invcnumb ;
WHERE ticket.custno = lncustno AND ;
(ticket.invcdebt - ticket.invccred) > 0.00) ;
INTO CURSOR csrTicket
ELSE
SELECT custno, invcnumb, invcdate, invcdesc, invcdebt, invccred, invcwght, invctype ;
FROM ticket ;
ORDER BY Ticket.custno, ticket.invcnumb ;
WHERE ticket.custno = lncustno ;
INTO CURSOR csrTicket
ENDIF
This.Parent.grdTicket.RecordSource = "csrTicket"
Thisform.Refresh()
Would someone give me a push in the right direction here?
Appreciate your time and any suggestions.
Judi