Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Can someone look at my code

Author  Topic 

gmag47
Starting Member

3 Posts

Posted - 2005-11-01 : 16:36:56
Hello,
I am trying the sum total from two different tables and than have them post a my web report form, can someone check my code and see what the problem is and what I need to do tomake my form work:

[code]
<FORM name="Merit_Principle.asp" method="post" action="Merit_Principle_Report.asp?action=submit">

<%
If Request.Querystring("action")="submit" Then
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open Server.MapPath("../HCMAP.mdb")

strSQL = "Select (average(Merit_Principle) + average(Merit_Promotion)) as Grandtotal from sum1 inner join sum2 on key1 = key2"



dim intAddition

dim Average
Average = Request.Form("1_Recruitment_was_appropriately_targeted") &Request.Form("2_Recruitment_produced_sufficient number_of_status_applicants")&Request.Form("3_Recruitment_produced_sufficient_number_of_non_st atus_applicant")&Request.Form("4_Certificate_referral_list_was_issued_in_a_timely _manner")&Request.Form("5_Length_of_open_period_for_announcement_was_reaso nable_based_on_the_type_of_job_number_of_potential _candidates")&Request.Form("6_Operational_procedures_addressed_issues_of_tardy _applicatons")&Request.Form("7_If_applicable_late_applications_from_10_point_ve rterans_preference_eligibles_are_maintained")&Request.Form("8_These_applications_were_notified_within_appropri ate_time_frame")&Request.Form("7_If_applicable_late_applications_from_10_point_ve rterans_preference_eligibles_are_maintained")&Request.Form("9_KSAs_crediting_plans_are_based_on_the_job_requir ements_and_were_effective_in_identifying_best_qual ified_candidates")&Request.Form("10_CTAP_ICTAP_RPL_candidates_received_proper_consi deratione_eligibles_are_maintained")&Request.Form("11_If_applicable_recruitment_adheres_to_ACWA_Lueva no_Consent_Decree_regulatory_compliance") ' add an fn for each of your form fields



conn.Execute strSQL
conn.Close
'Response.Redirect("Comments.asp")
End If
%>
[code]


Glen S. Magwood Sr

Glen S. Magwood Sr

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-11-02 : 17:23:42
Hi Glen

a couple of questions -
1. what is the problem - are you getting an error?
2. why would you add two averages in your SQL - what does this mean?
3. your Average calculation does not appear to be an average...(there's no divide at the end)
4. why do you calculate Average (as a string?) and then not use it anywhere?
5. why do you declare intAddition and then not use it anywhere?
6. why do you execute your SQL string - don't you want to iterate through the recordset returned (in this case only 1 record) and then do something with the GrandTotal result?

what are you actually trying to achieve?


--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -