HillTJ
To train a dog, first know more than the dog..
- Local time
- Yesterday, 16:09
- Joined
- Apr 1, 2019
- Messages
- 731
People, I have a form that has the following recordsource:
SELECT QuotesTBL.QUOTEID, QuotesTBL.JimCode, QuotesTBL.FreightID, QuotesTBL.QuoteValidity, QuotesTBL.[Delivery Location], QuotesTBL.Delivery_Address, QuotesTBL.CustcontactID, QuotesTBL.Date_Quoted, QuotesTBL.Quote_Description, QuotesTBL.Quoted_Freight, QuotesTBL.Cost_RM_STD, QuotesTBL.GP_Percentage, QuotesTBL.Cost_RM_LS, QuotesTBL.Cost_RM_Clr, QuotesTBL.Cost_MFG, QuotesTBL.Cost_RM_HV, QuotesTBL.EmployeeRef, QuotesTBL.Quote_Status, QuotesTBL.Quote_Status_Date, QuotesTBL.Cust_Order, QuotesTBL.Pronto_Sales_Order, QuotesTBL.[Quote_Accepted(Y/N)], TBLFreight.Freight_Rate, CompaniesTBL.Rebate_Percentage, CompaniesTBL.[Quote_Validity(Days)], QuotesTBL.Cost_RM_Stripe, QuotesTBL.Cost_RM_BLK, QuotesTBL.[AIM_GP ($)]
FROM CompaniesTBL INNER JOIN (TBLFreight INNER JOIN QuotesTBL ON TBLFreight.FreightID = QuotesTBL.FreightID) ON CompaniesTBL.JimCode = QuotesTBL.JimCode
WHERE (((QuotesTBL.EmployeeRef)=GetUserName()) AND ((GetUserLevel())=1)) OR (((GetUserLevel())<>1))
ORDER BY QuotesTBL.QUOTEID;
The concept is that only the records that are filtered by 'GetUserName' and 'GetUserLevel' are returned (so that the user only sees their own work) . This works fine for existing records. However, when a 'new' user opens the form, clearly there is no existing record to filter & display. Hence, an error message. The user can accept the error, then the form opens for data entry, but I'd rather not have the error message displayed.
How's it best to tackle this?
SELECT QuotesTBL.QUOTEID, QuotesTBL.JimCode, QuotesTBL.FreightID, QuotesTBL.QuoteValidity, QuotesTBL.[Delivery Location], QuotesTBL.Delivery_Address, QuotesTBL.CustcontactID, QuotesTBL.Date_Quoted, QuotesTBL.Quote_Description, QuotesTBL.Quoted_Freight, QuotesTBL.Cost_RM_STD, QuotesTBL.GP_Percentage, QuotesTBL.Cost_RM_LS, QuotesTBL.Cost_RM_Clr, QuotesTBL.Cost_MFG, QuotesTBL.Cost_RM_HV, QuotesTBL.EmployeeRef, QuotesTBL.Quote_Status, QuotesTBL.Quote_Status_Date, QuotesTBL.Cust_Order, QuotesTBL.Pronto_Sales_Order, QuotesTBL.[Quote_Accepted(Y/N)], TBLFreight.Freight_Rate, CompaniesTBL.Rebate_Percentage, CompaniesTBL.[Quote_Validity(Days)], QuotesTBL.Cost_RM_Stripe, QuotesTBL.Cost_RM_BLK, QuotesTBL.[AIM_GP ($)]
FROM CompaniesTBL INNER JOIN (TBLFreight INNER JOIN QuotesTBL ON TBLFreight.FreightID = QuotesTBL.FreightID) ON CompaniesTBL.JimCode = QuotesTBL.JimCode
WHERE (((QuotesTBL.EmployeeRef)=GetUserName()) AND ((GetUserLevel())=1)) OR (((GetUserLevel())<>1))
ORDER BY QuotesTBL.QUOTEID;
The concept is that only the records that are filtered by 'GetUserName' and 'GetUserLevel' are returned (so that the user only sees their own work) . This works fine for existing records. However, when a 'new' user opens the form, clearly there is no existing record to filter & display. Hence, an error message. The user can accept the error, then the form opens for data entry, but I'd rather not have the error message displayed.
How's it best to tackle this?