Connecting Tech Pros Worldwide Help | Site Map

database if statement with conditions

Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#1: Apr 17 '09
Hi, I wonder if anyone can advise.
One database field is never empty as I have a text editor that inputs <P>&nbsp;</P> even if I dont actually put any text. I need to check with an if statement if the field has either <P>&nbsp;</P> and "<br>" & vbCrLf
and if so write, no data availabel and if not write the field text.


I have this but it doesnt seem to do the trick

Expand|Select|Wrap|Line Numbers
  1. <%
  2. If Trim(PDFavQuote) = "" OR Trim(PDFavQuote) = "<P>&nbsp;</P>" OR (strPDFavQuote) = "<br>" OR (strPDFavQuote) = "<br>" & vbCrLf Then 
  3. %> 
  4. nothing available
  5. <%
  6. Else
  7. %> 
  8.  
  9. <br><h2>statement</h2><%=rs("PDFavQuote")%>
  10. <%
  11. End If
  12. %>
Any help would be great.
Thanks
Richard
Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#2: Apr 17 '09

re: database if statement with conditions


Hi, just to say I worked it out and this does the trick.

Expand|Select|Wrap|Line Numbers
  1. <% If Trim(rs("PDFavQuote")) = "" OR Trim(rs("PDFavQuote")) = "<P>&nbsp;</P>" OR Trim(rs("PDFavQuote")) = "<br>" OR Trim(rs("PDFavQuote")) = "<br>" & vbCrLf Then 
  2. %> 
  3. There is currently no statement
  4. <%
  5. Else
  6. %> 
  7. <%=rs("PDFavQuote")%>
  8. <%
  9. End If
  10. %>
Thanks
Richard
Reply