?
Solved

'error '800a000d' Type mismatch line 348

Posted on 2012-09-05
5
Medium Priority
?
975 Views
Last Modified: 2012-09-17
I am getting 'error '800a000d' Type mismatch line 348.
RowCount    = Session("strRowCount")
myArray     = Session("sessionmyArray")'error '800a000d' Type mismatch line 348
myArray(RowCount) = CString
For clarity the full code is below:
Thanks in advance for any help given.
<%
Sub BindData3()
currentPage = Request.QueryString("PageID")
if currentPage = 0 then
Response.Write("<div style='position:absolute;width:837px;height:366px;left:0px;top:260px;font-size:xx-small;overflow:auto;border:1px solid #722F90;' id='DIV999'>")
Response.Write("header2:" & currentPage & "#BindData3():<br/>")
Dim strRowArray2(20, 1)
Dim strRow    
Dim strColumn
Dim RowCount
Dim ColumnCount
strColumn = 1
CString = Session("sessionCString")
TableLabel = Session("sessionTableLabel")
RowCount = Session("strRowCount")
'****************************************
%>
<%
if RowCount = "" then
RowCount = 0
End if
Dim myArray()
ReDim Preserve myArray(RowCount) 'Re-Declaring a dynamic array
Session("sessionmyArray") = myArray
Response.Write("RowCount:" & RowCount & "#")
Response.Write ("Total element of the array = " & UBound(myArray) )
if RowCount = 0 then
myArray(RowCount) = CString
for i=0 to uBound(myArray)
Response.Write "<br>(" & i & ")" & myArray(i) & "#"
Next
Session("sessionmyArray") = myArray
response.write "<br/>array assigned to session var..."
Dim strRowArray
    strRowArray = Session("sessionmyArray") ' strRowArray(i, j)
    Dim oCounter : oCounter = 0
If IsArray(strRowArray) Then
      Dim strCountRow, strCountCol
      strCountRow  = UBound(strRowArray, 1)
      'strCountCol = UBound(strRowArray, 2) ' or the other way around...
      response.write "<br/>array dimensions: " & strCountRow & " x " & strCountCol
Else
      response.write "<br/>no array"
End If
else
RowCount    = Session("strRowCount")
myArray     = Session("sessionmyArray")'error '800a000d' Type mismatch line 348
myArray(RowCount) = CString
for i=0 to uBound(myArray)
Response.Write "<br>(" & i & ")" & myArray(i) & "#"
Next
Session("sessionmyArray") = myArray
response.write "<br/>array assigned to session var..."
strRowArray = Session("sessionmyArray") ' strRowArray(i, j)
oCounter = 0
If IsArray(strRowArray) Then
      strCountRow = UBound(strRowArray, 1)
      'strCountCol = UBound(strRowArray, 2) ' or the other way around...
      response.write "<br/>array dimensions: " & strCountRow & " x " & strCountCol
Else
      response.write "<br/>no array"
End If
end if
%>
<%
'****************************************
RowCount = RowCount + 1
Session("strRowCount") = RowCount
Response.Write("</div>")
end if  
End Sub
%>
<%
Select Case Request.Form("strButtonAction")
     Case "B1"
     BindData1()
     Case "B2"
     BindData2()
     Case "B3"
     BindData3()
     Case "B4"
     BindData4()
     Case "B5"
     BindData5()
     Case tempDefault
     txtProvider = Session("xtProvider")= "<font color='red'>NOT LOGGED IN!!</font>"
End Select
%>
0
Comment
Question by:homeshopper
  • 2
  • 2
5 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 2000 total points
ID: 38370332
I think that the error is caused by the declaration earlier:
Dim myArray()

Open in new window

You need that for the piece of code in between so I suggest using a temporary variable for the code starting at the error line 348:
Dim myArrayTEMP
myArrayTEMP     = Session("sessionmyArray")'error '800a000d' Type mismatch line 348 
myArrayTEMP(RowCount) = CString
for i=0 to uBound(myArrayTEMP)
Response.Write "<br>(" & i & ")" & myArrayTEMP(i) & "#"
Next 
Session("sessionmyArray") = myArrayTEMP

Open in new window

0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 38371015
Are you using a single dimension or multi dimension array?  Are you treating them as zero based? See the example below.  First you set your initial array size  - arr(1) meaning 2 rows.  Then to add another 2 rows reset the size to 3(4 rows) but use the Preserve keyword to keep the original data, then add your 2 new rows.

<%
Dim myDynArray() 'Dynamic size array
ReDim myDynArray(1)
myDynArray(0) = "Albert Einstein"
myDynArray(1) = "Mother Teresa"

ReDim Preserve myDynArray(3)
myDynArray(2) = "Bill Gates"
myDynArray(3) = "Martin Luther King Jr."

For Each item In myDynArray
      Response.Write(item & "<br />")
Next
%>
0
 

Author Comment

by:homeshopper
ID: 38372500
Hi  robert_schutt,
Thank you for your help. I used your suggested code and it now clears the error.
I have just one further query. The array is incremented and displays the last data row.
That is fine, but previous row elements are lost. It is not preserving the complete data records entered. Thanks in advance for any help given.
0
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 38372600
Well, it seems to me that in this part of the code:
Dim myArray()
ReDim Preserve myArray(RowCount) 'Re-Declaring a dynamic array
Session("sessionmyArray") = myArray

Open in new window

you actually empty out the array in the Session. Have a good look at what you want to do, maybe that part can be skipped altogether?
0
 

Author Comment

by:homeshopper
ID: 38406152
I had not neglected the question, but have been away.
I have now got it all working, so will award the points.
The complete solution is below for others to see.
Thankyou for the help.
<%
Sub BindData3()
currentPage = Request.QueryString("PageID")
if currentPage = 0 then
Response.Write("<div style='position:absolute;width:837px;height:354px;left:0px;top:270px;font-size:xx-small;overflow:auto;border:1px solid #722F90;' id='DIV999'>")
Response.Write("header2:" & currentPage & "#BindData3():<br/>")
Dim strRowArray2(20, 1)
Dim strRow    
Dim strColumn
Dim RowCount
Dim ColumnCount
strColumn = 1
CString = Session("sessionCString")
TableLabel = Session("sessionTableLabel")
RowCount = Session("strRowCount")
'****************************************
%>
<%
if RowCount = "" then
RowCount = 0
End if
Dim myArray()
ReDim Preserve myArray(RowCount) 'Re-Declaring a dynamic array
'Session("sessionmyArray") = myArray
Response.Write("RowCount:" & RowCount & "#")
'Response.Write ("Total element of the array = " & UBound(myArray) )
if RowCount = 0 then
myArray(RowCount) = CString
for i=0 to uBound(myArray)
Response.Write "<br>(" & i & ")" & myArray(i) & "#"
Next
Session("sessionmyArray") = myArray
response.write "<br/>array assigned to session var..."
Dim strRowArray
    strRowArray = Session("sessionmyArray") ' strRowArray(i, j)
    Dim oCounter : oCounter = 0
If IsArray(strRowArray) Then
      Dim strCountRow, strCountCol
      strCountRow  = UBound(strRowArray, 1)
      'strCountCol = UBound(strRowArray, 2) ' or the other way around...
      response.write "<br/>array dimensions: " & strCountRow & " x " & strCountCol
Else
      response.write "<br/>no array"
End If
else
RowCount    = Session("strRowCount")
Dim myArrayTEMP
myArrayTEMP     = Session("sessionmyArray")'error '800a000d' Type mismatch line 348
ReDim Preserve myArrayTEMP(RowCount) 'Re-Declaring a dynamic array
myArrayTEMP(RowCount) = CString
for i=0 to uBound(myArrayTEMP)
Response.Write "<br>(" & i & ")" & myArrayTEMP(i) & "#"
Next
Session("sessionmyArray") = myArrayTEMP

response.write "<br/>array assigned to session var..."
strRowArray = Session("sessionmyArray") ' strRowArray(i, j)
oCounter = 0
If IsArray(strRowArray) Then
      strCountRow = UBound(strRowArray, 1)
      'strCountCol = UBound(strRowArray, 2) ' or the other way around...
      response.write "<br/>array dimensions: " & strCountRow & " x " & strCountCol
Else
      response.write "<br/>no array"
End If
end if
%>
<%
'****************************************
RowCount = RowCount + 1
Session("strRowCount") = RowCount
Response.Write("</div>")
end if  
End Sub
%>
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

850 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