In a Select... From... Where... sqlsentence within a vbamodule, I want to surch in a Databasefield all the records that
start with one of the given strings with variable lenght. The list of strings is also variable (1, 2, 3 or more)
f.i. all the records that start with (121% or 87% or 4221%) or another ex. all the records that start with 1(37% or 93% or 8% or 3302%)
I tried with:
WHERE CONTAINS(Databasefield, ... ) -> offers the possibility to define more variable strings at a time but it doesn't work (problems with double quotes or sql-version?)
WHERE Databasefield IN( ) -> in combination with LEFT() but then all the strings need to have the same lenght;
WHERE Databasefield LIKE ... -> but then I have to repeat 'LIKE' manually with each string
WHERE INSTR(Databasefield, ... ) -> does work but only for one string at a time
It would be great if I could get all the data at a time with a query like this:
SELECT ... FROM ... WHERE INSTR(Databasefield, '121' or '87' or '422') = 1 "
Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.