I currently have a query that pulls information based on the user that is logged in. What I would like to do is if I am the user, I see all of the data. I can see it anyway through other means, but i would like to fix the SQL so it automatically does it. I have tried IIF statements with no luck. Basically, if I am the user, the Where statement would not exist. If I am not the user, then the where statement would exist. My SQL language is below.
Code:
SELECT tblPurchaseOrders.[ID], tblPurchaseOrders.[Sales ID], tblPurchaseOrders.[Assistant ID], tblPurchaseOrders.[Vendor ID], tblPurchaseOrders.[Retailer ID], tblPurchaseOrders.[PO Number], tblPurchaseOrders.[Amount], tblPurchaseOrders.[Due Date], tblPurchaseOrders.[Paid]
FROM tblAssistants INNER JOIN (tblsalesperson INNER JOIN tblPurchaseOrders ON tblsalesperson.[Sales ID] = tblPurchaseOrders.[Sales ID]) ON tblAssistants.[Assistant ID] = tblPurchaseOrders.[Assistant ID]
WHERE (((tblsalesperson.UserName)=TempVars!Username)) Or (((tblAssistants.UserName)=TempVars!Username));
Garret