Print Page | Close Window

If Then Statement help

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=11105
Printed Date: 31 March 2026 at 1:35am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: If Then Statement help
Posted By: photoshop_god
Subject: If Then Statement help
Date Posted: 06 July 2004 at 2:15pm

Hi,

I have been looking at this statement trying to figure out why it is not working.  I hope that someone here can help me out.

This is the statement that I'm having trouble with:

<% If (intRecordCount = "0") Then%><b>It appears that both Gregory and Marty are available for your wedding date!</b><% ElseIf (intRecordCount = "1") Then%><b>It appears that one photographer is available for your wedding date!</b><% ElseIf (intRecordCount > "1") Then%><b>I'm Sorry. It appears that both photographers are booked for that day.  Please contact the studio at 608.222.2698 to confirm this information.</b><% Else %><b>See If Your Wedding Date Is Available!</b><% End If %>

What's going on is someone enters in a date and the code goes out to a database and counts the number of records returned and then displays the appropriate message.  Everything is working fine exept when you first load the page is displays the second to last message

<b>I'm Sorry. It appears that both photographers are booked for that day.  Please contact the studio at 608.222.2698 to confirm this information.</b>

instead of my default message of

<b>See If Your Wedding Date Is Available!</b>.

I works if I change

<% ElseIf (intRecordCount > "1") Then %>

to < .  But I need the exact opposite.  Am I missing something?  I have also tried >= with no luck.

I would appreciate any help.




Replies:
Posted By: dj air
Date Posted: 06 July 2004 at 2:24pm
here is the code, the above code is hard to read

<% If (intRecordCount = "0") Then%><b>It appears that both Gregory and Marty are available for your wedding date!</b>

<% ElseIf (intRecordCount = "1") Then%><b>It appears that one photographer is available for your wedding date!</b>

<% ElseIf (intRecordCount > "1") Then%><b>I'm Sorry. It appears that both photographers are booked for that day.  Please contact the studio at 608.222.2698 to confirm this information.</b>

<% Else  %><b>See If Your Wedding Date Is Available!</b><% End If %>

you could make it so that there is a verable like select = False

and if that is False then show the default message and it is set to true if the form has been submitted.

add a value to the form that when it is sent it sends a value as true and that value is checked before action is done


Posted By: photoshop_god
Date Posted: 06 July 2004 at 2:29pm

Thanks dj air,

I just though of that after I posted.  I'm going to try it now.  Im sure this will solve my problem.  Thanks for the quick response.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net