Reputation: 81
Hey the following stored access query is giving POEventCode with "NA" when it is run through VBA excel and is giving the correct result when directly run from access.Why is this anomaly?
SELECT D.[Event Code] & D.[Week Code] AS POEventCode, *
INTO A
FROM (SELECT IIf([Advertisement type]='Tabloide','TAB',
IIf([Advertisement type]='Flyer','FLY','NA')) AS [Event Code],
IIf(([Start Date]>[SD] And [Start Date]<[ED]),
[Month] & Right([WM_WK],2),'NA')
AS [Week Code], *
FROM [Feature A-Traits] AS C, [Event Code] AS B)
AS D
WHERE (D.[Week Code]) Not Like '*NA*'
And (D.[Event Code]) Not Like '*NA*';
Upvotes: 0
Views: 767
Reputation: 3501
If you are using ADO running your query through VBA Excel then your wildcards need to be % not *, so:- Not Like '%NA%'
Upvotes: 5