Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do Until "*******************************" 3

Status
Not open for further replies.

perrymans

IS-IT--Management
Nov 27, 2001
1,340
US
The actual text I am looking for is:

Code:
Do Until strRowValue = "*******************************"

I would like to get away with:

Code:
Do Until strRowValue Like "********"

But Like doesn't work in VBA.

How would I do this?

Thanks. Sean.
 
Howdy perrymans . . .

Couldn't resist!:
Code:
[blue]   Do Until strRowValue Like [purple][b]"*[********]*"[/b][/purple][/blue]
[thumbsup2]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Thanks AceMan, I take it the brackets mean an unlimited amount of *** in the middle?

So I could get away with:

Code:
Do Until strRowValue Like "*[**]*"

Thanks. Sean.
 
But Like doesn't work in VBA
Really ?
Could you elaborate ?
 
Just that typing it hte way I had above did not return True in VBA, skipping the Loop I was trying to set off.

I had to put the exact number of ****.

I guess my point was it wasn't like SQL with

Like "*Sean*"

Thanks. Sean.
 
perrymans . . .

The outside characters "[red]*[/red][********][red]*[/red]" are the wild cards, the characters in brackets "*[[red]********[/red]]*" are eight actual [red]*[/red] characters, not wildcards!

As a insight into using brackets:
Microsoft said:
[blue]Search for two or more single characters in a field. You can use the [ ] wildcard with the Like operator in your queries to search for two or more single characters in a field.

For example, suppose you want to find all customers with the following ZIP codes: 08052, 08053, or 08055. To use the [ ] wildcard, enter the following in your query's Criteria row under the ZIP Code field:

Like "0805[235]"

This expression searches for all field entries whose last character matches one of the characters specified between the brackets. Conversely, to search for all customers that don't live within these three ZIP code areas, place an exclamation point before the list, as shown below:

Like "0805[!235]"

The exclamation point inside the brackets stands for Not in the list. The query results will include all entries whose characters do not match any character in the list within the brackets.

You can combine the [ ] wildcard with any other wildcard character. For example, you can combine the * wildcard character with [ ] to search for any ZIP codes that begin with 0805, 0807, or 0808:

Like "080[578]*"[/blue]
I just didn't want you to loose the connection that [blue]Like[/blue] can't be used in VBA! . . .


Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
perrymans . . .

Hit submitt too soon . . .

In your post origination . . .
Code:
[blue]Do Until strRowValue Like "********"[/blue]
. . . didn't work because [blue]you specified the wild card only![/blue] . . . which returns all!

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top