472,989 Members | 3,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

Asp If statement with condition

229 100+
Hi, I have this IF statement

Expand|Select|Wrap|Line Numbers
  1.                     <%
  2. If rsCard("DefaultMessage")="e-card" Then
  3. %>
  4.  
  5.  
  6. <a href="cards.asp?Post=<%=rsCard("Post")%>">
  7. <%
  8. Else
  9. %>
  10. <a href="gallery.asp?author=<%=rsCard("author")%>">
  11. <%
  12. End If
  13. %>
  14.  
  15. <I><%=rsCard("DefaultMessage")%></I><a> 
The default message will include other text apart from the word e-card. What I need is for the IF statement to say. IF the default message includes the word e-card in it somewhere, then xxxxxx else xxxxxxxx
and not if it is equal to e-card.
Anyone know if this is possible?

Thanks for any help in advance.
Richard
Oct 16 '07 #1
2 5378
markrawlingson
346 Expert 100+
Sure it is... Use the InStr method.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. 'If the word "e-card" appears in rsCart("DefaultMessage") at least once..
  3. If InStr(rsCard("DefaultMessage"),"e-card") > 0 Then
  4. %>
  5. <a href="cards.asp?Post=<%=rsCard("Post")%>">
  6. <%
  7. 'if it does not include the word "e-card" at least once...
  8. Else
  9. %>
  10. <a href="gallery.asp?author=<%=rsCard("author")%>">
  11. <%
  12. End If
  13. %>
  14. <I><%=rsCard("DefaultMessage")%></I><a>
  15.  
Hope this helps.
Sincerely,
Mark
Oct 16 '07 #2
fran7
229 100+
Dear Mark,
Thanks worked a treat.
I have had such geat help from this forum.
Thanks
Richard
Oct 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Fábio Mendes | last post by:
I'm sorry if it's an replicate. Either my e-mail program is messing with things or the python-list sent my msg to /dev/null. I couldn't find anything related in previous PEP's, so here it goes a...
6
by: crispy | last post by:
I am trying to say if (condition) is true OR (condition) is true THEN Can I use OR or do ihave to break it down into an elseif statement? I tried OR but it does not seem to work. thanks....
8
by: Henk van Winkoop | last post by:
Hello, I debugged some html file and found this: ------------------------------------------------------------ <script language="JavaScript"> if ( some_statement ) { function MyFunction (...
2
by: Rhino | last post by:
Is there some kind of requirement that a DECLARE CONTINUE HANDLER statement follow the DECLARE CURSOR statement in an SQL stored procedure? I am running DB2 V8.2.1 on Windows XP and am writing my...
2
by: mr_mach7 | last post by:
I have a situation in which I want to dynamically build a SQL statement based upon criteria. The statement would contain different fields depending upon the criteria. I created a Stored Procedure...
3
by: Ben R. | last post by:
In an article I was reading (http://www.ftponline.com/vsm/2005_06/magazine/columns/desktopdeveloper/), I read the following: "The ending condition of a VB.NET for loop is evaluated only once,...
5
by: jimc52 | last post by:
Hello Everyone: I am hoping one of the gurus here will give me some help. I have designed a form with some check boxes. I put the checkboxes there on the form so later I could use them as flags on...
7
by: reon | last post by:
In the below code.. else statements didnt work correctly... the program is to add the positive and negative numbers... if we enter alphabets it will show the wrong entry ,, but thats not...
22
by: John | last post by:
Hi Folks, I'm experimenting a little with creating a custom CEdit control so that I can decide on what the user is allowed to type into the control. I started off only allowing floating point...
3
by: sjohnson1984 | last post by:
Hello all, thanks for taking the time out to read this. I have a javascript function, the purpose of which is to compare 2 form values and redirect the user if two values are met - however,...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.