|
Subject:
|
expected Then
|
|
Posted By:
|
Adam H-W
|
Post Date:
|
11/25/2004 1:20:59 PM
|
Hi there
I've got a simple If Then statement and my page is throwing up an error; this is my code:
if isNull strShort or strShort = Empty Then response.Write(No Detail currently) else replace(strShort, vbcrlf, "<br>")) end if and it's giving me this error:
Microsoft VBScript compilation error '800a03f9'
Expected 'Then'
if isNull strShort or strShort = Empty ----------^
I don't know why because I've got Then on the line in question.
Any help greatly appreciated.
Thanks
Adam
|
|
Reply By:
|
ChrisScott
|
Reply Date:
|
11/25/2004 1:33:03 PM
|
Hi Adam,
Try this...
if IsNull(strShort) or strShort = Empty Then
response.Write("No Detail currently")
else
strShort = replace(strShort, vbcrlf, "<br>")
end if
HTH,
Chris
|
|
Reply By:
|
Adam H-W
|
Reply Date:
|
11/25/2004 1:39:40 PM
|
thanks for your input but it doesn't seem to solve it. The problem is on the line...if IsNull(strShort) or strShort = Empty Then - the error points to this line saying that 'Then' is expected whic dumbfounds me because then is already there
thanks
Adam
|
|
Reply By:
|
happygv
|
Reply Date:
|
11/25/2004 2:07:09 PM
|
quote: if isNull strShort or strShort = Empty Then
It that you want to check if the strShort variable is empty? or compare with another variable called "Empty" that hold some value in it? If you are looking for the first case, use ISEmpty() function or compare it with "".If isempty(strShort) then...
OR
If strShort = "" then
OR
If len(trim(strShort))>0 then All these should help you on the same cause.
Hope that helps. Cheers!
_________________________ - Vijay G Strive for Perfection
|
|
Reply By:
|
Adam H-W
|
Reply Date:
|
11/25/2004 2:59:33 PM
|
sorted, thanks guys
|
|
Reply By:
|
OldCoder
|
Reply Date:
|
11/25/2004 3:03:33 PM
|
Hi Adam,
This works on my machine:
<% dim strShort
if ( isNull(strShort) or strShort = Empty ) Then response.Write("No Detail currently") else replace strShort, vbcrlf, "<br>" end if %>
Happy Thanksgiving,
|
|
Reply By:
|
test
|
Reply Date:
|
4/17/2008 5:41:25 AM
|
   quote: Originally posted by ChrisScott
Hi Adam,
Try this...
if IsNull(strShort) or strShort = Empty Then res  ponse.Write("No Detail currently") else strShort = replace(strShort, vbcrlf, "<br>") end if
|