Hi all,
I'm trying to get an iif statement that would give me back all the data that got 1 or 600, if the "1-600" is selected, 299 or 999 if the "désuet" is selected and check in the txtCat if neither is selected to get the number inside the textbox. If i put 600 its work, but if i try 600 or 1, it doesn't work anymore, same for the 299-999. Is it the way i write it? or it just doesn't work this way?
if i would put 1 or 600 in the criterai without formula and everything it would report these 2, buit when in an iif statement, nothing...
Thanks for your help and here is the code:
Haerion
I'm trying to get an iif statement that would give me back all the data that got 1 or 600, if the "1-600" is selected, 299 or 999 if the "désuet" is selected and check in the txtCat if neither is selected to get the number inside the textbox. If i put 600 its work, but if i try 600 or 1, it doesn't work anymore, same for the 299-999. Is it the way i write it? or it just doesn't work this way?
if i would put 1 or 600 in the criterai without formula and everything it would report these 2, buit when in an iif statement, nothing...
Thanks for your help and here is the code:
Code:
INSERT INTO [PPA en traitement] ( STITEMNO, ITEMNO, ST, CAT, OH, OO, COM, TRSF, YTD, Cost, PYTD )
SELECT [ST] & [ITEMNO] AS stitemno, INVMSTR.ITEMNO, INVSTORE.ST, INVMSTR.PRO, INVSTORE.[QTY ON HAND], INVSTORE.[QTY ON ORDER], INVSTORE.[QTY COMMITTED], INVSTORE.[TRANSFER QTY], INVSTORE.[UNITS YTD], INVSTORE.AVGCOST, PURCHHST.[UNITS Y-T-D]
FROM (Clerks RIGHT JOIN INVMSTR ON Clerks.[Clerk#]=INVMSTR.PAGE) INNER JOIN (INVSTORE LEFT JOIN PURCHHST ON (INVSTORE.ST=PURCHHST.LC) AND (INVSTORE.ITEMNO1=PURCHHST.[ITEM NUMBER])) ON INVMSTR.ITEMNO=INVSTORE.ITEMNO1
WHERE ((INVMSTR.PRO)=IIf(forms![Main Form Info]!txtReportType="1-600",1 or 600,IIf(forms![Main Form Info]!txtReportType="désuet",299 Or 999,IIf(Trim(forms![Main Form Info]!txtCat & "")="",INVMSTR.PRO,forms![Main Form Info]!txtCat)))) And (([QTY ON HAND]>=forms![Main Form Info]!txtOH And forms![Main Form Info]!chkOH=1) Or ([QTY ON HAND]=forms![Main Form Info]!txtOH And forms![Main Form Info]!chkOH=2)) And (([UNITS YTD]>=forms![Main Form Info]!txtSoldYTD And forms![Main Form Info]!chkYTD=1) Or ([UNITS YTD]=forms![Main Form Info]!txtSoldYTD And forms![Main Form Info]!chkYTD=2)) And (([UNITS Y-T-D]>=forms![Main Form Info]!txtPurchYTD And forms![Main Form Info]!chkPurchYTD=1) Or ([UNITS Y-T-D]=forms![Main Form Info]!txtPurchYTD And forms![Main Form Info]!chkPurchYTD=2))
ORDER BY INVMSTR.ITEMNO, INVSTORE.ST;
Haerion