Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to build an array?

    How to build an array?

    I have the following lines in my code :

    If customer = 118 Then
    stock = stock - cartons
    ElseIf customer = 119
    stock = stock - cartons
    ElseIf customer = 120 Then '
    stock = stock - cartons
    ElseIf customer = 121 Then
    stock = stock - cartons
    ElseIf customer = 123 Then
    stock = stock - cartons

    Instead of these lines I want to build a simple code covering all the mentioned cusomers.
    If I build a line as:
    If customer 118 or 119 or 120 or 121 or 123 Then
    stock = stock - cartons
    I receive an error. I do not know why. Is there some other way of making this code, preferably with an array? I know it is ######ible but I cannot do it.

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: how to build an array?

    Try:

    <pre> If (customer = 118) or (customer = 119) or (customer = 120) or _
    (customer = 121) or (customer = 123) then
    stock = stock - cartons
    End If
    </pre>

    Legare Coleman

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: how to build an array?

    Or try this:

    <pre>Select Case customer
    Case 118, 119, 120, 121, 123
    stock = stock - cartons
    End Select</pre>


    This isn't the situation that calls for an array.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •