Why is this not working? (1 Viewer)

Mister-B

New member
Local time
Today, 18:51
Joined
Apr 10, 2020
Messages
23
Hi there,

I have a database that handles all the administration of training courses offered in our establishment.

I have a query that is supposed to find all the courses that are offered by a particular school this year but exclude all the Microsoft courses. Here's the query but it returns all the courses offered by the school including all Microsoft courses:

SELECT Daten.FoBiID, Daten.Jahr, Daten.Anbieter, Daten.Fortbildung, Daten.Von1, Daten.Bis1, Daten.Kennziffer, Daten.Aktenzeichen, Daten.Abgeschlossen, Daten.FoBi_Key
FROM Daten
WHERE (((Daten.Jahr)=Year(Date())) AND ((Daten.Anbieter)="Zentrale IT Betrieb") AND ((Daten.Fortbildung) Not Like "Microsoft*'"))
ORDER BY Daten.Fortbildung, Daten.Von1;

What am I missing?

Regards,
Martin
 
Are you using Table lookups for that field?, so it is not Microsoft at all? :(
I certainly would not have Microsoft in that field, but the PK from another table as FK.
 
I would use the single quote everywhere in that SQL string.
 
I was using normal quotation marks.
While I also think single quotes are better for SQL, this was not the problem you were dealing with.

Look at the criterion value from your original post:
Not Like "Microsoft*'"))
It's hard to see, so lets format this with a non-proportional font: "Microsoft*'"
-> There is an single quote at the end, which is part of the criterion when using double quotes. So, it must be matched by the data, which it probably wasn't.
 

Users who are viewing this thread

Back
Top Bottom