I'm sorry to say Mihail, that while that approach may well work functionally, it is generally considered a clumsy one. Instead of tidying the design, it spreads out where the various elements can be found. Not an approach to recommend :-(
Furthermore, and possibly even more important a point, it is introducing a potentially considerable delay into the query. SQL queries are optimised to the data. If a VBA function is introduced into the mix in the WHERE clause then each record of input must be extracted (thereby bypassing most of the said optimisations) and processed through VBA code which is, at least partially, interpreted. Relatively speaking, this is like taking a bus to win a F1 Grand Prix. Far better to work out the correct SQL first in VBA, in a single process, then execute it at top speed.