Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 29th, 2006, 09:58 AM
Authorized User
 
Join Date: Dec 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply.

But PvsSunCount is from query qryPvsWeek_Crosstab and SunCount is from query qryWeek_Crosstab.

So both are pulled from different recordsets.

How does this change the code that you had sent. Here's the breakdown for clarification.

SunCount - rsWk - qryWeek_Crosstab
PvsSunCount - rsPvsWk - qryPvsWeek_Crosstab

 
Old March 30th, 2006, 06:24 AM
Authorized User
 
Join Date: Mar 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It doesn't matter that they are from different recordsets.

However, I don't see the definition of SunCount or PvsSunCount in the sample code that you posted.

If these are defined at the top level of the server-side code; i.e.

<%
Dim SunCount

it should work... give it a try; check syntax because I didn't.

Joel
 
Old March 30th, 2006, 03:41 PM
Authorized User
 
Join Date: Dec 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm getting an error on this line.

<td><div align="center"><% =pctDif("Mc")%></div></td>

Microsoft VBScript runtime
Type mismatch:'pctDif'


 
Old April 4th, 2006, 04:22 AM
Authorized User
 
Join Date: Mar 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you define the Function?

Function pctDif(sItem)

Dim v1
Dim v2
Dim pctD

v1 = CDbl(SunCount(sItem))
v2 = CDbl(PVsSunCount(sItem))

If v2 = 0 then
  pctD = (v1-v2)/(v2 + 1e-6)
else
  pctD = (v1-v2)/v2
end if

pctDif = pctD

End Function


As I posted it to you???

Joel

 
Old April 4th, 2006, 04:25 AM
Authorized User
 
Join Date: Mar 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default


If so, try this:

Function pctDif(sItem)

Dim v1
Dim v2
Dim pctD

v1 = CDbl(SunCount(sItem))
v2 = CDbl(PVsSunCount(sItem))

If v2 = 0 then
  pctD = (v1-v2)/(v2 + 1e-6)
else
  pctD = (v1-v2)/v2
end if

pctDif = Cstr(pctD)

End Function


J
 
Old April 4th, 2006, 06:46 AM
Authorized User
 
Join Date: Dec 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was finally able to accomplish this task within an MS Access Query. I had to create a join between Category, WkNo, and DOW.
Thanks for everyone's help.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate Percentage with Date mateenmohd Access 2 February 4th, 2008 06:26 AM
how to calculate the percentage in sql yvr238 SQL Server 2000 1 May 13th, 2006 03:28 AM
Urgent! how to calculate difference between dates Subuana Beginning VB 6 2 March 22nd, 2006 05:34 PM
percentage darkhalf Javascript 2 October 28th, 2005 02:55 PM
how to calculate difference in dates ashu_gupta75 Excel VBA 3 August 9th, 2004 06:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.