PC Review


Reply
Thread Tools Rate Thread

Using a wildcard character in Select Case

 
 
Rose
Guest
Posts: n/a
 
      24th May 2004
Can this be done? I have a certain company that has many
locations, and the location is at the tail end of the name.
I need to find all companies that begin with the word
"Budget" for one of my select case statements. "Budget*" or
"Budget"* doesn't work.

The statement, FYI, is:
Case "Budget*", "OPSM", "Precision"
isGroup = "OPSM"

 
Reply With Quote
 
 
 
 
solex
Guest
Posts: n/a
 
      24th May 2004
Rose,

This is not possible with the select-case construct, but you could use an if
statement:

If company Like "Budget*" Then


"Rose" <(E-Mail Removed)> wrote in message
news:1163601c4419d$3c90ccd0$(E-Mail Removed)...
> Can this be done? I have a certain company that has many
> locations, and the location is at the tail end of the name.
> I need to find all companies that begin with the word
> "Budget" for one of my select case statements. "Budget*" or
> "Budget"* doesn't work.
>
> The statement, FYI, is:
> Case "Budget*", "OPSM", "Precision"
> isGroup = "OPSM"
>



 
Reply With Quote
 
Rose
Guest
Posts: n/a
 
      24th May 2004
Crap. I need to use Select because I actually have about 15
companies I'm herding off to their own particular groups,
and that's too long for an If. (I only quoted part of the
whole function in my example.)

Are my only other solutions to either change my data, run
another layer of query to effectively change my data, or
have an incredibly long (and regularly updated) Select
statement?

>-----Original Message-----
>Rose,
>
>This is not possible with the select-case construct, but

you could use an if
>statement:
>
>If company Like "Budget*" Then
>
>
>"Rose" <(E-Mail Removed)> wrote in message
>news:1163601c4419d$3c90ccd0$(E-Mail Removed)...
>> Can this be done? I have a certain company that has many
>> locations, and the location is at the tail end of the name.
>> I need to find all companies that begin with the word
>> "Budget" for one of my select case statements. "Budget*" or
>> "Budget"* doesn't work.
>>
>> The statement, FYI, is:
>> Case "Budget*", "OPSM", "Precision"
>> isGroup = "OPSM"
>>

>
>
>.
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      24th May 2004
You can specify a range in a Case.

Since the wildcard is the trailing character, this should work:

Case "Budget" to "Budgetzzzzzzzzz", "OPSM", "Precision"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rose" <(E-Mail Removed)> wrote in message
news:1163601c4419d$3c90ccd0$(E-Mail Removed)...
> Can this be done? I have a certain company that has many
> locations, and the location is at the tail end of the name.
> I need to find all companies that begin with the word
> "Budget" for one of my select case statements. "Budget*" or
> "Budget"* doesn't work.
>
> The statement, FYI, is:
> Case "Budget*", "OPSM", "Precision"
> isGroup = "OPSM"



 
Reply With Quote
 
solex
Guest
Posts: n/a
 
      24th May 2004
Rose,

Can you provide all of your examples I am not sure I follow exactly what you
want to do?
For instance you stated that the location name is always at the end of the
company name so why not look at it from that prespective and combine it with
your select case statement for instance:

If companyname LIKE "*OPSM" Then
IsGroup = "OPSM"
Else If companyName Like "*XXX" Then
IsGroup = "XXX"
Else If ...

Else
Select Case companyName
Case "Percision"
Case ...
End Select
End If

You could as you suggested create another table that relates the company to
a group such as:

CompanyID, GroupID


Regards,
Dan

"Rose" <(E-Mail Removed)> wrote in message
news:115a601c441a0$eb405090$(E-Mail Removed)...
> Crap. I need to use Select because I actually have about 15
> companies I'm herding off to their own particular groups,
> and that's too long for an If. (I only quoted part of the
> whole function in my example.)
>
> Are my only other solutions to either change my data, run
> another layer of query to effectively change my data, or
> have an incredibly long (and regularly updated) Select
> statement?
>
> >-----Original Message-----
> >Rose,
> >
> >This is not possible with the select-case construct, but

> you could use an if
> >statement:
> >
> >If company Like "Budget*" Then
> >
> >
> >"Rose" <(E-Mail Removed)> wrote in message
> >news:1163601c4419d$3c90ccd0$(E-Mail Removed)...
> >> Can this be done? I have a certain company that has many
> >> locations, and the location is at the tail end of the name.
> >> I need to find all companies that begin with the word
> >> "Budget" for one of my select case statements. "Budget*" or
> >> "Budget"* doesn't work.
> >>
> >> The statement, FYI, is:
> >> Case "Budget*", "OPSM", "Precision"
> >> isGroup = "OPSM"
> >>

> >
> >
> >.
> >



 
Reply With Quote
 
Rose
Guest
Posts: n/a
 
      24th May 2004
Perfect - thanks!!

>-----Original Message-----
>You can specify a range in a Case.
>
>Since the wildcard is the trailing character, this should

work:
>
>Case "Budget" to "Budgetzzzzzzzzz", "OPSM", "Precision"
>
>--
>Allen Browne - Microsoft MVP. Perth, Western Australia.
>Tips for Access users - http://allenbrowne.com/tips.html
>Reply to group, rather than allenbrowne at mvps dot org.
>
>"Rose" <(E-Mail Removed)> wrote in message
>news:1163601c4419d$3c90ccd0$(E-Mail Removed)...
>> Can this be done? I have a certain company that has many
>> locations, and the location is at the tail end of the name.
>> I need to find all companies that begin with the word
>> "Budget" for one of my select case statements. "Budget*" or
>> "Budget"* doesn't work.
>>
>> The statement, FYI, is:
>> Case "Budget*", "OPSM", "Precision"
>> isGroup = "OPSM"

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use * as character, not as wildcard Matthew Pfluger Microsoft Access ADP SQL Server 2 23rd Apr 2009 05:37 PM
BindingSource filter wildcard character for a single character olympus_mons@gmx.de Microsoft ADO .NET 0 30th Aug 2007 01:34 PM
Select case wildcard =?Utf-8?B?bWFib25k?= Microsoft VB .NET 6 20th Mar 2006 06:52 PM
Wildcard character with Select Statement Mike Microsoft Excel Programming 1 12th Dec 2003 08:21 PM
Select Case Wildcard Charles D Clayton Jr Microsoft Access VBA Modules 6 3rd Nov 2003 07:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:37 PM.