We recently migrated a very old site to a new server and are running into an odd issue. There is a simple if statement which should and did on old server read as true but it is not and not sure why. The statement is below. When I write out invflag it is equal to 1 which is what I would expect.
'does not trigger as true so iChk remains = "" iChk = "" if invflag = True then iChk = "checked" end if 'Works as expected iChk = "" if invflag = "1" then iChk = "checked" end if 'works as expected iChk = "" if invflag = 1 then iChk = "checked" end if
I know we can simply fix this as you can see but we have these types of statements littered throughout the code and if there is something with the server or database we can set that would be ideal and thought I would check.
Simply casting to CBool should do the trick for all cases:
CBool
If CBool(invflag) = True Then iChk = "checked" End If
or better
If CBool(invflag) Then iChk = "checked" End If
2.1m questions
2.1m answers
60 comments
57.0k users