Counting credits per checked box

Results 1 to 3 of 3

Thread: Counting credits per checked box

  1. #1
    Join Date
    Dec 1969

    Default Counting credits per checked box

    I want to add the integers of the records with only checked boxes. Here is the code I have to work with, but everything I am trying is failing, any ideas? :<BR><BR> iCounter = 1<BR> fTotalHoursAttended = 0<BR> rs.MoveFirst<BR> rs.MoveLast &#039Properly set RecordCount property<BR> rs.MoveFirst<BR> For i = 1 to rs.RecordCount<BR> sFieldName = "chkCertificate" & i<BR> If Request.Form(sFieldName) = "true" Then<BR> If sStartDate &#060;&#062; "" Then &#039This is going to be a date range certificate<BR> sEndDate = rs("ConferenceDate")<BR> End If<BR> If sStartDate = "" Then &#039If this is the first checked checkbox, set the start date<BR> sStartDate = rs("ConferenceDate")<BR> sLectureCode = rs("LectureID") &#039We only need the lecture code for a single date certicate<BR>fTotalHoursAttended = fTotalHoursAttended + rs("HoursAttended")<BR>&#039 fTotalHoursAttended = CInt(rs("HoursAttended"))<BR>&#039fHoursAttended will get overwritten a date range was selected<BR> End If<BR> sConferenceCode = rs("ConferenceCode") &#039Need this for both single and multi-date certificate<BR> End If<BR> rs.MoveNext<BR> Next<BR><BR>Thanks,<BR>Daniel

  2. #2
    Steve Cimino Guest

    Default Response.Write

    I believe checkboxes return "on", not true.<BR><BR>To test, place a few Response.write in your code.<BR><BR>For i = 1 to rs.RecordCount<BR>sFieldName = "chkCertificate" & i<BR>response.write Request.Form(sFieldName) &#039Are you sure what you&#039re getting?<BR><BR>If Request.Form(sFieldName) = "true" Then<BR>Response.write "check box " & i & " should be on!"<BR><BR>ALWAYS do this to test things. Don&#039t assume that your code has no logic errors. Once you see your results, you can adjust accordingly.<BR>

  3. #3
    Join Date
    Dec 1969

    Default UPDATE: Response.Write

    The checkboxes definately return as &#039true&#039 or &#039false&#039<BR><BR>When I Response.Write as you suggest it does show that I have the right checkboxes checked I.e. chkCertificate2chkCertificate5<BR><BR>Now what I NEED to do is capture the field rs(HoursAttended) from those records that returned TRUE.<BR><BR>Any ideas?<BR><BR>Thanks,<BR>Daniel<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts