Solved How to select all entries that begin with a given value?

mamradzelvy

Member
Local time
Tomorrow, 00:45
Joined
Apr 14, 2020
Messages
145
Hi,
I'm using a simple query to export records based on client names.
And the WHERE part of my query looks like this WHERE (((Tabule1.TabKlient)=[Formuláře]![formTabuleMini]![txtKlient])) OR ((([Formuláře]![formTabuleMini]![txtKlient]) Is Null));
(This works well, "formuláře" is a valid syntax in my language's access version, don't worry about it)
What im worried about is how to make it so that the rest of the client name can be whatever, for instance i have clients such as "Pepsi; Pepsi-CityName; Pepsi-AnotherCity" and when i put in just pepsi, i would like it to select everything that begins with pepsi.
How would i write the proper syntax for that?
 
Try:
WHERE (((Tabule1.TabKlient)=Like [Formuláře]![formTabuleMini]![txtKlient] & "*")) OR ((([Formuláře]![formTabuleMini]![txtKlient]) Is Null));
 
Code:
WHERE ((InStr([TabKlient],Nz([Formuláře]![formTabuleMini]![txtKlient],[TabKlient]))>0));
 
The Like will probably perform faster than the instr()
 

Users who are viewing this thread

Back
Top Bottom