?
Solved

Subscription out of range: '[number: 46]'

Posted on 2003-03-31
6
Medium Priority
?
571 Views
Last Modified: 2007-12-19
Microsoft VBScript runtime error '800a0009'

subscription out of range: '[number: 46]'

/eventRegistrationASP/saveregistration.asp, line 58
0
Comment
Question by:amalik75
5 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 8239789
better post your code then....
0
 

Author Comment

by:amalik75
ID: 8239809
<%option explicit%>
<!-- #include file="../CommonASP/CommonFunctions.asp" -->
<!-- #include file="../CommonASP/Replacing.asp" -->
<!-- #include file="../CommonASP/DataStringToArray.asp" -->
<%

dim intRegCode,intCtr,intCtr1
dim strCompanionName,strRegRecd,strCurrDate,strCheckPONum,strAdditionalComp,strApprovalNum,strDateCancelled
dim strArrDate,strDepDate,strOccupancy,strRecdBy,strIRIUser,strUpdated,strCountryName,strOfficialEmailComID
dim strOfficialFaxComID,strOfficialPhoneComID,strPmtCountryName,strNomCountryName

dim dblAdditionalFee,dblAmtRecd,dblRefundAmt
dim intFirstTime,intCompFirstMeeting,intNbrAttending,intRepGolfHcap,intCompGolfHcap,intBowlScore,intCompBowlScorer
dim intBillTo,intMailTo,intNomAddr,intNominatorId

dim SessionArray()
Dim AddressArray(0,12)
dim PaymentArray(0,13)
dim ComNumberArray(2,6)
dim BillingArray(0,20)

dim strSessionArray

dim NewSession

dim objSelect
dim objRegInsert

''''''''''Declaration start for mail component '''''''
Dim strtouser
Dim strFromUser  
Dim strSubject
Dim strMessage
Dim var_eventName
Dim var_eventDate
Dim var_eventLocation
Dim var_Itinerary
Dim var_eventdetails
Dim rstEventDetails

''''''''''Declaration end for mail component '''''''
 

Dim blnCompanion,blnRegistrant,strAddressType,strType,strRegCode
Dim rsTemp,rstRegCode

''''''''''functions for creating arrays and other variables'''''''
Sub CreateSessionArray()
intctr = 0
strSessionArray=""
For intctr1 = 0 To UBound(Session("SessionGroup"), 2)
    If Session("SessionGroup")(1, intctr1) <> "No" Then
   
        blnCompanion = "0"
        blnRegistrant = "0"
       
        If Session("SessionGroup")(2, intctr1) = "R" Then
            If Session("SessionGroup")(0, intctr1) = Session("SessionGroup")(0, intctr1 + 1) And Session("SessionGroup")(1, intctr1 + 1) <> "No" Then
                blnCompanion = "1"
            End If
        Else
            If Session("SessionGroup")(0, intctr1) = Session("SessionGroup")(0, intctr1 - 1) And Session("SessionGroup")(1, intctr1 - 1) <> "No" Then
                blnRegistrant = "1"
            End If
        End If
       
        If blnRegistrant = "0" Then
            ReDim Preserve SessionArray(10,intctr)
            strSessionArray=strSessionArray & "A"
            SessionArray(0,intctr) = "A"
           
            strSessionArray=strSessionArray & "|" & intctr + 1
            SessionArray(1,intctr) = intctr + 1
           
            strSessionArray=strSessionArray & "|" & ""
            SessionArray(2,intctr) = ""
           
            If blnCompanion = "1" Then
                        strSessionArray=strSessionArray & "|2"
                SessionArray(3,intCtr) = "2"
            Else
                        strSessionArray=strSessionArray & "|1"  
                SessionArray(3,intctr) = "1"
            End If
            If Session("SessionGroup")(2, intctr1) = "R" And Session("SessionGroup")(1, intctr1) <> "Yes" Then
                        strSessionArray=strSessionArray & "|" & Session("SessionGroup")(1, intctr1)
                SessionArray(4,intctr) = Session("SessionGroup")(1, intctr1)
            Else
                        strSessionArray=strSessionArray & "|" & ""
                SessionArray(4,intctr) = ""
            End If
                       
            If blnCompanion = "1" Then
                If Session("SessionGroup")(1, intctr1 + 1) <> "Yes" Then
                              strSessionArray=strSessionArray & "|" & Session("SessionGroup")(1, intctr1 + 1)
                    SessionArray(5, intctr) = Session("SessionGroup")(1, intctr1 + 1)
                Else
                              strSessionArray=strSessionArray & "|" & ""
                    SessionArray(5, intctr) = ""
                End If
            Else
                'If Session("SessionGroup")(1, intctr1) <> "Yes" Then
            '                  strSessionArray=strSessionArray & "|" & Session("SessionGroup")(1, intctr1)
                '    SessionArray(5, intctr) = Session("SessionGroup")(1, intctr1)
                'Else
                              strSessionArray=strSessionArray & "|" & ""
                    SessionArray(5, intctr) = ""
                'End If
            End If
           
            strSessionArray=strSessionArray & "|0" & ""
            SessionArray(6, intctr) = "0"
           
            strSessionArray=strSessionArray & "|" & ""
            SessionArray(7, intctr) = ""
           
            If blnCompanion = "1" Then
                        strSessionArray=strSessionArray & "|" & blnCompanion
                SessionArray(8, intctr) = blnCompanion
            Else
                If Session("SessionGroup")(2, intctr1) = "C" Then
                              strSessionArray=strSessionArray & "|1"
                    SessionArray(8, intctr) = "1"
                Else
                              strSessionArray=strSessionArray & "|0"
                    SessionArray(8, intctr) = "0"
                End If
            End If
            strSessionArray=strSessionArray & "|" & Session("SessionGroup")(0, intctr1)
            SessionArray(9, intctr) = Session("SessionGroup")(0, intctr1)
           
            strSessionArray=strSessionArray & "|" & ""  & "^"
            SessionArray(10, intctr) = ""
           
            If blnCompanion = "1" Then
                intctr1 = intctr1 + 1
            End If
            intctr = intctr + 1
        End If
    End If
Next
      if strSessionArray>"" then      
            strSessionArray=left(strSessionArray,len(strSessionArray)-1)
      end if
      
      NewSession=MakeTwoDimentionalArray(strSessionArray)      
      
End Sub

Sub CreateAddressArray()
      
      'ReDim Preserve AddressArray(10,0)
      if Session("blnAddress")=true then
            AddressArray(0,0) = "U"
      else
            AddressArray(0,0) = "A"
      end if
      AddressArray(0,1) = "1"
      
      if  objSelect.DoExecSelect("tblAddressTypeByType","Employer") <>false then
            set rsTemp = objSelect.rsMain       
            if not (rstemp.eof and rstemp.bof) then
                  strType=trim(rsTemp("A_Id")) & ""
            end if      
            set rsTemp=nothing
      end if      
                                          
      AddressArray(0,2) = strType
      AddressArray(0,3) = Session("MemberInfoArray")(intAddress)
      AddressArray(0,4) = Session("MemberInfoArray")(intCity)
      AddressArray(0,5) = Session("MemberInfoArray")(intState)
      AddressArray(0,6) = Session("MemberInfoArray")(intZip)
      if Session("MemberInfoArray")(intCountry)<>"-1" then
            if  objSelect.DoExecSelect("tblCountry",Session("MemberInfoArray")(intCountry)) <>false then
                  set rsTemp = objSelect.rsMain       
                  if not (rstemp.eof and rstemp.bof) then
                        strCountryName=trim(rsTemp("CountryName")) & ""
                  end if      
                  set rsTemp=nothing
            end if                  
            AddressArray(0,7) = strCountryName
      else
            AddressArray(0,7) = ""
      end if
      AddressArray(0,8) = ""
      AddressArray(0,9) = ""
      AddressArray(0,10) = Session("AddressID")
      AddressArray(0,11) = ""
      AddressArray(0,12) = ""

End Sub

Sub CreatePaymentArray()
      strCurrDate=now()  'to be removed
      'ReDim Preserve PaymentArray(12, 0)
      PaymentArray(0,0) = "A"
      PaymentArray(0,1) = "1"
      PaymentArray(0,2) = Session("PaymentInfoArray")(intPmtCardName)
      PaymentArray(0,3) = strCurrDate
      PaymentArray(0,4) = Session("PaymentInfoArray")(intPmtCardHolder)
      PaymentArray(0,5) = "***" & right(Session("PaymentInfoArray")(intPmtCardNo),4)
      PaymentArray(0,6) = Session("PaymentInfoArray")(intPmtExpMonth)       
      PaymentArray(0,7) = Session("PaymentInfoArray")(intPmtExpYear)
      PaymentArray(0,8) = ""
      PaymentArray(0,9) = Session("EventTotalCost")
      PaymentArray(0,10) = "0"
      PaymentArray(0,11)= "0"
      PaymentArray(0,12)= Session("MemberInfoArray")(intName)
      PaymentArray(0,13)= "0"
End Sub


Sub CreateComNumberArray()
      if  objSelect.DoExecSelect("tblComTypeAll") <>false then
            set rsTemp = objSelect.rsMain       
            do while not rsTemp.eof
                  if rsTemp("Type")="Office" then                              
                        strOfficialPhoneComID=rsTemp("CommunicationID")
                  elseif rsTemp("Type")="FAX" then
                        strOfficialFaxComID=rsTemp("CommunicationID")                              
                  elseif rsTemp("Type")="E-Mail" then
                        strOfficialEmailComID=rsTemp("CommunicationID")                              
                  end if
                  rsTemp.movenext
            loop                              
      end if                  
      set rsTemp=nothing
      'ReDim Preserve ComNumberArray(3,0)      
      if Session("blnOfficePhone")=true then
            ComNumberArray(0,0) = "U"
      else
            ComNumberArray(0,0) = "A"
      end if
      
      ComNumberArray(0,1) = "1"
      ComNumberArray(0,2) = strOfficialPhoneComID
      ComNumberArray(0,3) = Session("MemberInfoArray")(intOfficePhone)
      ComNumberArray(0,4) = Session("PhoneComId")
      ComNumberArray(0,5) = ""
      ComNumberArray(0,6) = ""

      'ReDim Preserve ComNumberArray(3, 1)
      if Session("blnOfficeFax")=true then      
            ComNumberArray(1,0) = "U"
      else
            ComNumberArray(1,0) = "A"
      end if
      ComNumberArray(1,1) = "2"
      ComNumberArray(1,2) = strOfficialFaxComID
      ComNumberArray(1,3) = Session("MemberInfoArray")(intOfficeFax)
      ComNumberArray(1,4) = Session("FaxComId")
      ComNumberArray(1,5) = ""
      ComNumberArray(1,6) = ""

      'ReDim Preserve ComNumberArray(3, 2)      
      if Session("blnOfficeEmail")=true then      
            ComNumberArray(2,0) = "U"
      else
            ComNumberArray(2,0) = "A"
      end if
      ComNumberArray(2,1)= "3"
      ComNumberArray(2,2) = strOfficialEmailComID
      ComNumberArray(2,3) = Session("MemberInfoArray")(intOfficeEmail)      
      ComNumberArray(2,4) =Session("EmailComId")
      ComNumberArray(2,5) = ""
      ComNumberArray(2,6) = ""      
End Sub

Sub CreateBillingArray()
      'ReDim Preserve BillingArray(9, 0)
      BillingArray(0,0) = "A"
      BillingArray(0,1) = "1"
      BillingArray(0,2) =Session("PaymentInfoArray")(intPmtFullName)
      BillingArray(0,3) =Session("PaymentInfoArray")(intPmtCompanyName)
      BillingArray(0,4) =Session("PaymentInfoArray")(intPmtAddress)
      BillingArray(0,5) =Session("PaymentInfoArray")(intPmtCity)      
      BillingArray(0,6) =Session("PaymentInfoArray")(intPmtState)
      BillingArray(0,7) =Session("PaymentInfoArray")(intPmtZip)            
      BillingArray(0,8) =Session("PaymentInfoArray")(intPmtPhone)
      if Session("PaymentInfoArray")(intPmtCountry)<>"-1" then
            if  objSelect.DoExecSelect("tblCountry",Session("PaymentInfoArray")(intPmtCountry)) <>false then
                  set rsTemp = objSelect.rsMain       
                  if not (rstemp.eof and rstemp.bof) then
                        strPmtCountryName=trim(rsTemp("CountryName")) & ""
                  end if      
                  set rsTemp=nothing
            end if                        
            BillingArray(0,9) = strPmtCountryName
      else
            BillingArray(0,9) = ""
      end if
      '''''      
      BillingArray(0,10) =Session("MemberInfoArray")(intNomPrefix)
      BillingArray(0,11) =Session("MemberInfoArray")(intNomFirstName)
      BillingArray(0,12) =Session("MemberInfoArray")(intNomMI)
      BillingArray(0,13) =Session("MemberInfoArray")(intNomLastName)
      BillingArray(0,14) =Session("MemberInfoArray")(intNomTitle)
      BillingArray(0,15) =Session("MemberInfoArray")(intNomAddress)
      BillingArray(0,16) =Session("MemberInfoArray")(intNomCity)
      BillingArray(0,17) =Session("MemberInfoArray")(intNomState)
      BillingArray(0,18) =Session("MemberInfoArray")(intNomZip)
      if Session("MemberInfoArray")(intNomCountry) <> "-1" and Session("MemberInfoArray")(intNomCountry) > "" then
            if  objSelect.DoExecSelect("tblCountry",Session("MemberInfoArray")(intNomCountry)) <>false then
                  set rsTemp = objSelect.rsMain       
                  if not (rstemp.eof and rstemp.bof) then
                        strNomCountryName=trim(rsTemp("CountryName")) & ""
                  end if      
                  set rsTemp=nothing
            end if                              
            BillingArray(0,19) = strNomCountryName
      else
            BillingArray(0,19) = ""
      end if      
      ''''''
      BillingArray(0,20) = "0"      
End Sub

Sub CreateOtherVariables()

      'strCompanionName=Session("MemberInfoArray")(intComPrefix) & " " & Session("MemberInfoArray")(intComFirstName)
      'if Session("MemberInfoArray")(intComMI)>"" then
      '      strCompanionName=strCompanionName & " " &  Session("MemberInfoArray")(intComMI)
      'end if
      'strCompanionName=strCompanionName & " " &  Session("MemberInfoArray")(intComLastName)
      strCompanionName=Session("MemberInfoArray")(intComLastName)  

      strArrDate=Session("MemberInfoArray")(intHotArrDay) & "-" & mid(monthname(Session("MemberInfoArray")(intHotArrMonth)),1,3) & "-" & Session("MemberInfoArray")(intHotArrYear)
      strDepDate=Session("MemberInfoArray")(intHotDepDay) & "-" & mid(monthname(Session("MemberInfoArray")(intHotDepMonth)),1,3) & "-" & Session("MemberInfoArray")(intHotDepYear)


      intNominatorId=0  ' to be changed

            if trim(Session("MemberInfoArray")(intComLastName))>"" then      
            If objSelect.DoExecSelect("tblRegistrationCodesByDescription","Participant with companion")=true Then
                  Set rstRegCode = objSelect.rsMain
                  strRegCode=rstRegCode("RegCode")                        
            else
                  strRegCode=""
            End if
      else
            If objSelect.DoExecSelect("tblRegistrationCodesByDescription","Participant")=true Then
                  Set rstRegCode = objSelect.rsMain
                  strRegCode=rstRegCode("RegCode")                        
            else
                  strRegCode=""
            End if
      end if
      set rstRegCode=nothing
            
      strRegRecd=Now()
      strCurrDate=Now()
      dblAdditionalFee=0
      strCheckPONum=""
      dblAmtRecd=Session("EventTotalCost") ' it is the total cost of the event
      dblRefundAmt=0
      intFirstTime=0
      intCompFirstMeeting=0
      strAdditionalComp=""
      intNbrAttending=0
      strApprovalNum=""
      strDateCancelled="null"
      strOccupancy=""
      intRepGolfHCap=0
      intCompGolfHCap=0
      intBowlScore=0
      intCompBowlScorer=0
      strRecdBy=""
      strIRIUser=""
      strUpdated=Now()
      intBillTo=0
      intMailTo=0
      intNomAddr=0 ' to be changed
      
End Sub
''''''''''functions for creating arrays and other variables*************ended

Set objSelect = server.CreateObject("WebBC.clsSelect")
objSelect.connString = Session("strConnectionString")
objSelect.DoOpenConnection


Set objRegInsert = server.CreateObject("WebBC.clsRegistration")
objRegInsert.connString = Session("strConnectionString")
objRegInsert.DoOpenConnection

'''''''''making of SessionGroup array
Call CreateSessionArray()

If Session("MemberInfoArray")(intIsUpdate)="ON" then      
      '''''''''making of address array
      Call CreateAddressArray()
      '''''''''making of Com Number array
      Call CreateComNumberArray()      
end if


'''''''''making of Payment array
Call CreatePaymentArray()

'''''''''making of Payment array
Call CreateBillingArray

'''creation of other variables
Call CreateOtherVariables()

intRegCode=objRegInsert.DoExecInsertRegistration(Session("MemberInfoArray")(intName),strRegCode,_
            Session("SessionEventId"),intNominatorId,strRegRecd,strCurrDate,_
        Session("PaymentInfoArray")(intPmtCardName),dblAdditionalFee,strCheckPONum,_
        "***" & right(session("PaymentInfoArray")(intPmtCardNo),4),dblAmtRecd,dblRefundAmt,strCurrDate,intFirstTime,_
        strCompanionName, intCompFirstMeeting,strAdditionalComp,intNbrAttending,_
        session("MemberInfoArray")(intBadgeName),strApprovalNum, strDateCancelled,strArrDate,_
        strDepDate,Session("MemberInfoArray")(intHotSmoking),strOccupancy, Session("MemberInfoArray")(intHotDietary),_
        Session("MemberInfoArray")(intHotSpecial),intRepGolfHcap,intCompGolfHcap,intBowlScore,_
        intCompBowlScorer,strRecdBy,strIRIUser,strUpdated,intBillTo,intMailTo,intNomAddr,_
        Session("MemberInfoArray")(intEmergencyName),Session("MemberInfoArray")(intEmergencyPhone),_
        Session("MemberInfoArray")(intHotRooming),Session("MemberInfoArray")(intMisc1),_
        Session("MemberInfoArray")(intMisc2),Session("MemberInfoArray")(intMisc3),_
        Session("MemberInfoArray")(intMisc4),NewSession,PaymentArray,AddressArray,ComNumberArray,BillingArray)
       
     
''''''''''''''code to send execution to Event_Itenerary.asp
if intRegCode>0 then
      
      Session("RegCode")=intRegCode      
      Response.redirect "Event_Itinerary.asp"      
else
      Response.redirect "errormsg.asp"
end if%>

0
 
LVL 6

Accepted Solution

by:
MannSoft earned 300 total points
ID: 8240284
Your loop looks like:

For intctr1 = 0 To UBound(Session("SessionGroup"), 2)

which is fine, but inside that loop, on the line where that error occurs you have:

If Session("SessionGroup")(0, intctr1) = Session("SessionGroup")(0, intctr1 + 1) And Session("SessionGroup")(1, intctr1 + 1) <> "No" Then

When you do the + 1, that means on the very last time through the loop you will be checking 1 index past the end of the array.  So probably if you change the loop to:

For intctr1 = 0 to UBound(Session("SessionGroup"), 2) - 1

it would work
0
 
LVL 6

Expert Comment

by:MannSoft
ID: 8240297
Although that may screw up with other code inside the loop.  You may need to do it another way, such as checking to see if intctr1 = UBound(Session("SessionGroup"")), and if it does, then skip the part where you are checking the next item in the array.
0
 
LVL 58

Expert Comment

by:Gary
ID: 9182530
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by MannSoft

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
There is a wide range of advantages associated with the use of ASP.NET. This is why this programming framework is used to create excellent enterprise-class websites, technologies, and web applications.
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question