Forums

ASP

This topic is locked

VBScript Help need

Posted 13 Mar 2009 17:15:38
1
has voted
13 Mar 2009 17:15:38 Andy Laverdiere, Jr. posted:
I am trying to write a script for a web page connected to an Access database using Dreamweaver 8 that will replace a cost of $0.00 with "Call For Pricing". I have it working to the point where it will display either the price of the first item on the list or the "Call For Pricing" message for all items in the table but it won't display both the message when it is applicable or the actual listed price of each item as it appears in the database table. What am I doing wrong? Here is the code I wrote for it :

<% 
If (rsCourses.Fields.Item("CourseCost").Value = 0) Then
rsCourses_CFP = "Call For Pricing" 
ElseIf (rsCourses.Fields.Item("CourseCost").Value    <> 0) Then
rsCourses_CFP = FormatCurrency((rsCourses.Fields.Item("CourseCost").Value), 2, -2, -2, -2) 
End If
%>





Your help would be greatly appreciated!
Thanks!
Andy

Edited by - Andy Laverdiere, Jr. on 14 Mar 2009  05:36:10

Replies

Replied 28 Mar 2009 19:35:22
28 Mar 2009 19:35:22 Andy Laverdiere, Jr. replied:
Hey All,
Just wanted to let anyone interested know I was helped with this issue on another forum and here is the solution:

<% 
While ((Repeat1__numRows <> 0) AND (NOT rsCourses.EOF)) 
%>
<% 
If (rsCourses.Fields.Item("CourseCost").Value = 0.00) Then 
rsCourses_CFP = "Call For Pricing" 
Else 
rsCourses_CFP = FormatCurrency((rsCourses.Fields.Item("CourseCost").Value), 2, -2, -2, -2) 
End If 
%>
<%= rsCourses_CFP %>
                  <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsCourses.MoveNext()
Wend
%>


All I needed to do was move my script inside the repeat region to make it work properly.

Thanks,
Andy

Reply to this topic