CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 SQL command in Custom Code

Print topic Send  topic

Author Message
Dreamcatchers


Posts: 120
Posted: 05/25/2010, 1:21 PM

I am trying to average a column of data from a specific record set and display it on a form. I get no errors but no data either.

In the events table I use ID as the index.
In the Roster table I use rosterid as the index and ID is a copy of the events id for cross referencing

The column to average is SurveyQ1

So here is what I did...

Create a label name Q1 on the Events form to display the average of all Survey Question related to the Events Record which are stored in the Roster table

Created custom code for Q1 as...

Dim SQL
Dim Connection
Dim ErrorMessage
Dim surveyavg
Set Connection = New clsDBintranet
Connection.Open
SQL = "SELECT Avg(surveyq1) as surveyavg FROM Roster where id=" & events.id.Value
Connection.Execute(SQL)
ErrorMessage = CCProcessError(Connection)
events.Q1.Value = surveyavg
Connection.Close
Set Connection = Nothing
On Error Goto 0

Any ideas on what I am doing wrong?
_________________
Training and LMS Developer
View profile  Send private message
TheunisP

Posts: 342
Posted: 05/30/2010, 4:12 AM

this is your 1st problem: events.Q1.Value = surveyavg


I assume you have an on error resume somewhere that is why you are not getting an error on that line, think about it for a second how is ASP supposed to kow that surveyavg is a SQL return variable?

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.