vba - Comparison Logic -


i have if statement assuming comparing each value each other. seems no matter values (e.g. values contain count of 4) goes else. missing in if statement?

 if rst![countofprovider] = rst![countofdelivery type] = rst![countofbu creator] = rst![countoforigin] = rst![countofsub-destination] = rst![countofdestination zipcode] = rst![countofcity] = rst![countofstate] = rst![countofcost zone] = rst![countofrate] = rst![countofmarket name]         chk = false     else         chk = true     end if  

vba doesn't perform sequence of comparisons seem expect.

consider simpler example immediate window ...

debug.print 2 = 2 true debug.print 2 = 2 = 2 false 

i'm uncertain how vba handles multiple equality comparisons, suspect may testing first , comparing result next ... sort of ...

debug.print (2 = 2) = 2 false 

the first comparison returns true, integer -1 ...

debug.print cint(2 = 2) -1  

so means final comparison equivalent ...

debug.print -1 = 2 

and naturally returns false.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -