Need help using Or in an If Statement

Home Forums Scripting General Scripting Need help using Or in an If Statement

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    wullieb1
    Participant
    #127532

    Need some help guy’s.

    I have created a script that inserts a string into an array and depending on the first letter of that string will insert the correct folder name into another string value.

    If strCustomerName = “CUSTOMER” then
    strfolderName = strYear & “_” & “CUSTOMER”
    elseif arrCustName(0) = “A” Or “B” Or “C” Or “D” Or “E” then
    strfolderName = strYear & “_” & “A-E”
    elseif arrCustName(0) = “F” Or “G” Or “H” Or “I” Or “J” then
    strfolderName = strYear & “_” & “F-J”
    elseif arrCustName(0) = “K” Or “L” Or “M” Or “N” Or “O” then
    strfolderName = strYear & “_” & “K-O”
    elseif arrCustName(0) = “P” Or “Q” Or “R” Or “S” Or “T” then
    strfolderName = strYear & “_” & “P-T”
    elseif arrCustName(0) = “U” Or “V” Or “W” Or “X” Or “Y” Or “Z” then
    strfolderName = strYear & “_” & “U-Z”
    end if[/CODE]

    All of my code works if i comment out from the [B]Or[/B] after [B]”A”[/B] and use a customer name beginning with “A”.

    What i want to do is check to see if the value stored in arrCusName(0) is equal to A or B or C or D or E to be put into the folder marked A-E however when i run the above code i get a type mismatch: ‘[string: “B”]’ code 800A000D.

    Any help will be appreciated.[CODE]If strCustomerName = “CUSTOMER” then
    strfolderName = strYear & “_” & “CUSTOMER”
    elseif arrCustName(0) = “A” Or “B” Or “C” Or “D” Or “E” then
    strfolderName = strYear & “_” & “A-E”
    elseif arrCustName(0) = “F” Or “G” Or “H” Or “I” Or “J” then
    strfolderName = strYear & “_” & “F-J”
    elseif arrCustName(0) = “K” Or “L” Or “M” Or “N” Or “O” then
    strfolderName = strYear & “_” & “K-O”
    elseif arrCustName(0) = “P” Or “Q” Or “R” Or “S” Or “T” then
    strfolderName = strYear & “_” & “P-T”
    elseif arrCustName(0) = “U” Or “V” Or “W” Or “X” Or “Y” Or “Z” then
    strfolderName = strYear & “_” & “U-Z”
    end if[/CODE]

    All of my code works if i comment out from the Or after “A” and use a customer name beginning with “A”.

    What i want to do is check to see if the value stored in arrCusName(0) is equal to A or B or C or D or E to be put into the folder marked A-E however when i run the above code i get a type mismatch: ‘[string: “B”]’ code 800A000D.

    Any help will be appreciated.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.