Hi All,
I have a query which exports to a excel file afterwards, however, it's not capturing all the data I need. I can see why it's not working as intended, but can't work out how to resolve it.
My query is at the bottom, and I think the problem is the "(([tbl Master].ID)=[tblRequest].[Cost Centre]))" statement, as this means that it'll never pick up a Cost Centre starting with "Z", as they don't exist in [tbl Master] (they're exceptions to the rule basically).
What I need to do is only parse the statement "(([tbl Master].ID)=[tblRequest].[Cost Centre]))" if the Cost Centre doesn't start with "Z", if it does, then it'll find it in the table, as there's validation on the point of entry that don't start with it.
It anyone able to help at all?
Many thanks for help in advance.
Kind regards,
Thomas
I have a query which exports to a excel file afterwards, however, it's not capturing all the data I need. I can see why it's not working as intended, but can't work out how to resolve it.
My query is at the bottom, and I think the problem is the "(([tbl Master].ID)=[tblRequest].[Cost Centre]))" statement, as this means that it'll never pick up a Cost Centre starting with "Z", as they don't exist in [tbl Master] (they're exceptions to the rule basically).
What I need to do is only parse the statement "(([tbl Master].ID)=[tblRequest].[Cost Centre]))" if the Cost Centre doesn't start with "Z", if it does, then it'll find it in the table, as there's validation on the point of entry that don't start with it.
It anyone able to help at all?
Many thanks for help in advance.
Kind regards,
Thomas
Code:
SELECT tblRequest.RequestID, 'N/A' AS [Week No], tblRequest.[Refund Date] AS [Date],
tblRequest.Requester, tblRequest.Authoriser, tblRequest.Refunder AS Processor,
tblRequest.[CRIS Reference] AS [CRIS Ref No], tblRequest.[Customer Title] & ' ' & [Customer Name] AS [Customer's Name],
tblRequest.[Reason Type] AS [Transaction Type], Format(tblRequest.Value,'£0.00') AS Amount,
tblRequest.DCRef AS [Gift Card No], tblGCProc.PPTAuth AS [PPT Auth No],
IIf(Left(tblRequest.[Cost Centre],1)='Z','WEBSTORE',[tbl Master].NAME) AS Store
FROM tblRequest, tblGCProc, [tbl Master]
WHERE (((tblRequest.[Refund Date])>=#7/9/2013# And (tblRequest.[Refund Date])<=#7/10/2013#)
AND ((tblGCProc.RequestID)=[tblRequest].[RequestID]) AND ((tblRequest.Currency)='Sterling')
AND ((tblRequest.Brand)<>'BHS') AND (([tbl Master].ID)=[tblRequest].[Cost Centre]))
ORDER BY tblGCProc.ID;
Last edited: