Wildcard for number in variant

ejhatch

Registered User.
Local time
Today, 10:39
Joined
Oct 12, 2005
Messages
26
Hi All,

I am trying to use a wildcard in a variable.

I have set my variable as follows:

dim stDocName as Variant

In the code the stDocName gets assigned the name of the query.

In certain instances this will be = qryFutureDatedIT0000 or qryFutureDatedIT0001 etc etc.

I want to be able to find any query which starts qryFutureDated

I have tried # which I believe is to be used for numbers. I have tried qryFutureDatedIT####

There will always be 4 digits. Alas this is not being picked up.

I have tested it by using the actual name of the query selected e.g. qryFutureDatedIT0000 and this is picked up, but I want to make use of wildcards.

In the locals window I notice that the variable stDocName has attributes of string/variant

Any idea of what I should be using as my wildcard.

Thanks,

Evan
 
First of all, stDocName isn't Variant, it's a string.

Second, if you're searching table/query container, merely use the left function to strip off the first part of and text the query name.
 
ejHatch, how are you performing the search?

ADO uses "%", VBA uses "*"

You don't need a variant, use a string

dim stDocName as String

You want your search criteria, to look like this

"qryName Like 'qryFutureDated" & "*'"
or
"qryName Like 'qryFutureDated" & "%'"

AGAIN, what method are you using, for the search?
Query Def?
ADO?
ADOX?
DLookUp?
 
Hi All,

Thanks for that. I tried the different ways and the best way I managed was to use the left function and pull back specific text.

Thanks,

Evan
 

Users who are viewing this thread

Back
Top Bottom