object variable or block with variable not set vb6 -
i trying itemid , quantity of items combining tables getting following error: "object variable or block variable not set" can find solution code is:
openrecset cmrptitem, tmp, "select items.itemid, round(sum(qty),2) sqty (select itemid,opnstock qty,floor(opnstock/packing) pty items " & _ " itemid = '" & rsrptitem.fields(0) & "' union select itemid,qty=sum(case ret when 'n' -1 * (abs(quantity) + abs(free)) " & _ " when 't' -1 * (abs(quantity) + abs(free))when 'y' abs(quantity) + abs(free) end),pty=sum(case ret when 'n' -1 * (abs(pqty))" & _ " when 't' -1 * (abs(pqty))when 'y' abs(pqty) end) sales2,sales1 sales2.billno=sales1.billno , itemid='tip91' " & _ " , date <= '" & dtto.value & "' group itemid union select itemid,qty=sum(case ret when 'n' -1 * (abs(quantity) + abs(free)) " & _ " when 't' -1 * (abs(quantity) + abs(free))when 'y' abs(quantity) + abs(free) end),pty=sum(case ret when 'n' -1 * (abs(pqty)) " & _ " when 't' -1 * (abs(pqty))when " & _ " 'y' abs(pqty) end) sales8a2,sales8a1 sales8a2.billno=sales8a1.billno , itemid='tip91' , date <= '" & dtto.value & "' " & _ " group itemid union select itemid,sum (quantity) qty, sum(pqty) pty editstock itemid='tip91' , " & _ " date <= '" & dtto.value & "' group itemid union select itemid,qty=sum(case ret when 'n' " & _ " (abs(quantity)+ abs(free)-abs(quantity*wastage/100)) when 'y' -1 * (abs(quantity)+ abs(free)-abs(quantity*wastage/100)) end), " & _ " pty=sum(case ret when 'n' abs(pqty) when 'y' -1 *abs(pqty) end) purchase2,purchase1 purchase2.billno=purchase1.billno , " & _ " itemid='tip91' , date <= '" & dtto.value & "' group itemid union select itemid, sum (quantity) qty, sum(pqty) pty " & _ " salesreturn2,salesreturn1 salesreturn2.billno=salesreturn1.billno , itemid='tip91'and date <= '" & dtto.value & "' group itemid union " & _ " select itemid, sum (-1 * quantity) qty, sum(-1 * pqty) pty purchasereturn2,purchasereturn1 " & _ " purchasereturn2.billno=purchasereturn1.billno , itemid='tip91' , date <= '" & dtto.value & "' group itemid union select itemid, " & _ " sum (-1 * quantity) qty, sum(-1 * pqty) pty freenote2,freenote1 freenote2.billno=freenote1.billno , itemid='" & rsrptitem.fields(0) & "' , " & _ " date <= '" & dtto.value & "' group itemid union select itemid, sum (-1 * quantity) qty, sum(-1 * pqty) pty transfer2, " & _ " transfer1 transfer2.billno=transfer1.billno , itemid='" & rsrptitem.fields(0) & "' , date <= '" & dtto.value & "' group itemid) mainqry, items items.itemid=mainqry.itemid group items.itemid"
Comments
Post a Comment