AS/400: Comparison operator in if statement

75 pts.
Tags:
AS/400
My code is like this:
Dim compare as string
If op1=true then compare=">"
Else if op1=false then compare="<"
Else if op1.visible=false then compare="="
If compare 0 then msgbotext1msgbox" Here compare has assigned > or< or= but it not work Error no.13 type mismatch
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

No answer yet

Try
If compare = “0” then msgbotext1msgbox
or
If compare null then
or
If compare “” then…

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • pdraebel
    What type is declared for the op1 and op1.visible? These should be logical fields.
    7,545 pointsBadges:
    report
  • ToddN2000
    We need more info. Can you post the complete code? pdrebel brings up a good point. Without the complete code, we are guessing.
    132,660 pointsBadges:
    report
  • Habibg79
    Simply I want to assign operand to string e.g

    Dim opr as string
    Opr = " > "

    If A > 0 then ......
    Here I want
    If A & opr &  0 then.......
    But it not work in vb6
    If we use oprin select query then it work but in if statement
    It's not work,I have to use in if statement,I want s
    same code to operate for different operand
    75 pointsBadges:
    report
  • ToddN2000
    I assume that this line should have been up with the others.

    If compare 0 then msgbotext1msgbox" 
    If this is the case then you are tying to compare a numeric 0 to a character string. Change the zero to a null or empty value.
    132,660 pointsBadges:
    report
  • Habibg79
    Simply I want to assign operand to string and then use it in if statement

    Dim opr as string
    Opr= " > "

    If A & opr & 0 then msgbox "something"

    In the above line this code gives error, I want to change operand by assigning to opr ,and use same code for  > < =, opr pick > < = in above code and return msg
    75 pointsBadges:
    report
  • ToddN2000
    Sounds like you are trying to build a page dynamically. Just concatenate your elements together. Are you trying to do this in RPG/Free or via a stored procedure or other means?
    132,660 pointsBadges:
    report
  • Habibg79
    I think u r not understand me or I can't explain myself, we close discussion here
    75 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: