Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2008

Tip: Looking for answers? Try searching our database.

coding help(OR statement)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ah - 12 Feb 2008 03:45 GMT
Hi, appreciate if someone could help me with the following:

I've created a form with the folowing user form coding:

Dim myArray4() As String    'CCM
Dim myArray6() As String    'FRANCE
Dim myArray7() As String    'GERMANY
Dim myArray19() As String   'UNITED KINGDOM

Dim i As Long

myArray6 = Split("AN(Angers) CR(Crolles) FR(France) PR(Paris) TL(Toulouse)")

Me.PayScaleArea.Clear
Select Case ActiveDocument.FormFields("Country_Name").Result
 
   Case "Switzerland"
       Me.PayScaleArea.List = myArray4

 
   Case "FRANCE"
       Me.PayScaleArea.List = myArray6
   Case "GERMANY"
       Me.PayScaleArea.List = myArray7
   
   Case "UK/IRELAND"
       Me.PayScaleArea.List = myArray19

End Select
End Sub

-------------

I wish to get the same selection list with Germany (myArray7) when I select
another 2 country called "Switzerland" or "Denmark".
Can anyone guide me on how to put a OR statement in the above coding?
Greg Maxey - 12 Feb 2008 03:59 GMT
I am not sure if I understand your question.

You want the same thing in the list if the user selects GERMANY, DENMARK or
SWITZERLAND?

Private Sub UserForm_Initialize()

Dim myArray4() As String    'CCM
Dim myArray6() As String    'FRANCE
Dim myArray7() As String    'GERMANY
Dim myArray19() As String   'UNITED KINGDOM
Dim pStr As String
Dim i As Long

myArray6 = Split("AN(Angers) CR(Crolles) FR(France) PR(Paris) TL(Toulouse)")
myArray7 = Split("A B C D E F G")
pStr = "DENMARK"
Me.PayScaleArea.Clear
Select Case pStr 'ActiveDocument.FormFields("Country_Name").Result
 Case "FRANCE"
   Me.PayScaleArea.List = myArray6
 Case "GERMANY", "SWITZERLAND", "DENMARK"
    Me.PayScaleArea.List = myArray7
 Case "UK/IRELAND"
    Me.PayScaleArea.List = myArray19
End Select
End Sub

Signature

~~~~~~~~~~~~~~~~~~~~~~~~~~~
Greg Maxey -  Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> Hi, appreciate if someone could help me with the following:
>
[quoted text clipped - 32 lines]
> select another 2 country called "Switzerland" or "Denmark".
> Can anyone guide me on how to put a OR statement in the above coding?
Jay Freedman - 12 Feb 2008 04:03 GMT
>Hi, appreciate if someone could help me with the following:
>
[quoted text clipped - 32 lines]
>another 2 country called "Switzerland" or "Denmark".
>Can anyone guide me on how to put a OR statement in the above coding?

Just add the expressions to the same Case line, separated by commas:

  Case "GERMANY", "SWITZERLAND", "DENMARK"

Then any of those three values will cause the myArray7 value to be assigned.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.