why the code dont work cotrrect in <> condition!

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

why the code dont work cotrrect in <> condition!

Post by sal21 »

i have CC_ESt dimensioned as string.
Why the cdoe not control the condition <> in the two case!!!!
See image.
Tks.

Code: Select all

CC_EST = ""
CC_EST = Trim(CC_DAILY_RS("DIVISA"))

If CC_EST <> "EUR" Or CC_EST <> "EU1" Then
GAF_RS("PRODOTTO") = "CONTI CORRENTI ESTERO"
End If

User avatar
HansV
Administrator
Posts: 78478
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: why the code dont work cotrrect in <> condition!

Post by HansV »

The condition CC_EST <> "EUR" Or CC_EST <> "EU1" will always be true, for if CC_EST is equal to "EUR", it is not equal to "EU1" and vice versa.

I think you want

If CC_EST <> "EUR" And CC_EST <> "EU1" Then
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: why the code dont work cotrrect in <> condition!

Post by sal21 »

HansV wrote:The condition CC_EST <> "EUR" Or CC_EST <> "EU1" will always be true, for if CC_EST is equal to "EUR", it is not equal to "EU1" and vice versa.

I think you want

If CC_EST <> "EUR" And CC_EST <> "EU1" Then
as usual TKS!