0
Explorer
,
/t5/dreamweaver-discussions/vbscript-help/td-p/826828
Mar 13, 2009
Mar 13, 2009
Copy link to clipboard
Copied
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 according to the conditions stated.
What am I doing wrong? I attached the code I wrote for it but I am not even sure if I am headed in the right direction as I have also tried variations but get the same result.
Andy
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 according to the conditions stated.
What am I doing wrong? I attached the code I wrote for it but I am not even sure if I am headed in the right direction as I have also tried variations but get the same result.
Andy
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Explorer
,
Mar 15, 2009
Mar 15, 2009
Ken,
YouR question about the repeat region got me thinking and that's what the problem was! I had the code I wrote in the wrong place (below the recordset binding as it appeared in my original post). I moved it inside the repeat region in the body of the page (as it now appears in this post) and it is now working great!
You are an ACE!!
Thanks so much my friend! That is why I have found this forum second to none for ALL my web authoring questions since discovering Dreamweaver (Version 4).
...
YouR question about the repeat region got me thinking and that's what the problem was! I had the code I wrote in the wrong place (below the recordset binding as it appeared in my original post). I moved it inside the repeat region in the body of the page (as it now appears in this post) and it is now working great!
You are an ACE!!
Thanks so much my friend! That is why I have found this forum second to none for ALL my web authoring questions since discovering Dreamweaver (Version 4).
...
LEGEND
,
/t5/dreamweaver-discussions/vbscript-help/m-p/826829#M164565
Mar 14, 2009
Mar 14, 2009
Copy link to clipboard
Copied
"Andy Lav Jr." <alj@johnwkennedyco.com> wrote in
message news:gpf6l6$qkr$1@forums.macromedia.com...
> 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 according
> to the conditions stated.
>
> What am I doing wrong? I attached the code I wrote for it but I am not
> even sure if I am headed in the right direction as I have also tried variations
> but get the same result.
>
> Andy
>
> <%
> Dim rsCourses
> Dim rsCourses_cmd
> Dim rsCourses_numRows
>
> Set rsCourses_cmd = Server.CreateObject ("ADODB.Command")
> rsCourses_cmd.ActiveConnection = MM_dsnTech_STRING
> rsCourses_cmd.CommandText = "SELECT * FROM Courses WHERE CCode Like
> 'TC'+'%'"
> rsCourses_cmd.Prepared = true
>
> Set rsCourses = rsCourses_cmd.Execute
> rsCourses_numRows = 0
> %>
> <%
> 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
> %>
>
How about just using Else?
<%
If (rsCourses.Fields.Item("CourseCost").Value = 0) Then
rsCourses_CFP = "Call For Pricing"
Else
rsCourses_CFP = FormatCurrency((rsCourses.Fields.Item("CourseCost").Value), 2, -2, -2, -2)
End If
%>
--
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com
> 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 according
> to the conditions stated.
>
> What am I doing wrong? I attached the code I wrote for it but I am not
> even sure if I am headed in the right direction as I have also tried variations
> but get the same result.
>
> Andy
>
> <%
> Dim rsCourses
> Dim rsCourses_cmd
> Dim rsCourses_numRows
>
> Set rsCourses_cmd = Server.CreateObject ("ADODB.Command")
> rsCourses_cmd.ActiveConnection = MM_dsnTech_STRING
> rsCourses_cmd.CommandText = "SELECT * FROM Courses WHERE CCode Like
> 'TC'+'%'"
> rsCourses_cmd.Prepared = true
>
> Set rsCourses = rsCourses_cmd.Execute
> rsCourses_numRows = 0
> %>
> <%
> 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
> %>
>
How about just using Else?
<%
If (rsCourses.Fields.Item("CourseCost").Value = 0) Then
rsCourses_CFP = "Call For Pricing"
Else
rsCourses_CFP = FormatCurrency((rsCourses.Fields.Item("CourseCost").Value), 2, -2, -2, -2)
End If
%>
--
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Andy Lav Jr.
AUTHOR
Explorer
,
/t5/dreamweaver-discussions/vbscript-help/m-p/826830#M164567
Mar 14, 2009
Mar 14, 2009
Copy link to clipboard
Copied
Ken,
Thanks for the suggestion but I tried that and all records still display the price of the first record only.
Andy
Thanks for the suggestion but I tried that and all records still display the price of the first record only.
Andy
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/vbscript-help/m-p/826831#M164568
Mar 14, 2009
Mar 14, 2009
Copy link to clipboard
Copied
"Andy Lav Jr." <alj@johnwkennedyco.com> wrote in
message news:gpi0f4$424$1@forums.macromedia.com...
> Ken,
> Thanks for the suggestion but I tried that and all records still display the price of the first record only.
> Andy
Andy,
What does your repeat region look like without the tweaking?
--
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com
> Ken,
> Thanks for the suggestion but I tried that and all records still display the price of the first record only.
> Andy
Andy,
What does your repeat region look like without the tweaking?
--
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/dreamweaver-discussions/vbscript-help/m-p/826832#M164570
Mar 15, 2009
Mar 15, 2009
Copy link to clipboard
Copied
Ken,
YouR question about the repeat region got me thinking and that's what the problem was! I had the code I wrote in the wrong place (below the recordset binding as it appeared in my original post). I moved it inside the repeat region in the body of the page (as it now appears in this post) and it is now working great!
You are an ACE!!
Thanks so much my friend! That is why I have found this forum second to none for ALL my web authoring questions since discovering Dreamweaver (Version 4).
Thanks Again!
Andy
YouR question about the repeat region got me thinking and that's what the problem was! I had the code I wrote in the wrong place (below the recordset binding as it appeared in my original post). I moved it inside the repeat region in the body of the page (as it now appears in this post) and it is now working great!
You are an ACE!!
Thanks so much my friend! That is why I have found this forum second to none for ALL my web authoring questions since discovering Dreamweaver (Version 4).
Thanks Again!
Andy
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/dreamweaver-discussions/vbscript-help/m-p/826833#M164571
Mar 15, 2009
Mar 15, 2009
Copy link to clipboard
Copied
"Andy Lav Jr." <alj@johnwkennedyco.com> wrote in
message news:gpja77$miu$1@forums.macromedia.com...
> Ken,
> You question about the repeat region got me thinking and that's what the
> problem was! I had the code I wrote in the wrong place (below the recordset
> binding as it appeared in my original post). I moved it inside the repeat
> region in the body of the page (as it now appears in this post) and it is now
> working great!
>
> You are an ACE!!
>
> Thanks so much my friend! That is why I have found this forum second to
> none for ALL my web authoring questions since discovering Dreamweaver (Version
> 4).
>
> Thanks Again!
>
> Andy
>
> <%
> 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
> %>
>
Andy,
Glad you got it sorted!
--
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com
> Ken,
> You question about the repeat region got me thinking and that's what the
> problem was! I had the code I wrote in the wrong place (below the recordset
> binding as it appeared in my original post). I moved it inside the repeat
> region in the body of the page (as it now appears in this post) and it is now
> working great!
>
> You are an ACE!!
>
> Thanks so much my friend! That is why I have found this forum second to
> none for ALL my web authoring questions since discovering Dreamweaver (Version
> 4).
>
> Thanks Again!
>
> Andy
>
> <%
> 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
> %>
>
Andy,
Glad you got it sorted!
--
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
http://www.cfnoob.com
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

