Clarkie001
IS-IT--Management
I am receiving a runtime error 'Invalid Procedure on the MID functions in the following code.
Please shed some light on this..
Thanks
Clarkie
<%
dim conn, rs, sql
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("Nuggit_v1.0.mdb"))
set rs = server.createobject("ADODB.Recordset")
sql = "SELECT * FROM tblRetailer_Product_Key;"
rs.open sql, conn, 3
Dim iStart
Dim iProductKey
Dim iKeyLength
Dim i
Dim myArray()
Dim myArray2()
Dim strCurrComma
Do until rs.EOF
iKeyLength = Len(rs("Product_key"))
For i = 1 To iKeyLength
strCurrComma = Mid(rs("Product_Key"), i, 1)
If strCurrComma = Chr(44) Then
redim myarray(0)
If isarray(myArray) Then
ReDim Preserve myArray(UBound(myArray) + 1)
myArray(UBound(myArray)) = i
Else
ReDim myArray(0)
myArray(UBound(myArray)) = i
End If
End If
Next
For i = 0 To UBound(myArray)
If i > 0 Then
If isarray(myarray2) Then
redim myarray2(0)
ReDim Preserve myArray2(UBound(myArray2) + 1)
myArray2(UBound(myArray2)) = myArray(i) - myArray(i - 1)
Else
ReDim myArray2(0)
myArray2(0) = myArray(0)
End If
End If
Next
For i = 0 To UBound(myArray) + 1
If i = 0 Then 'First Product Key in sequence
iProductKey = Mid(rs("Product_Key"),1, myArray(i) - 1)
Else If i > UBound(myArray) Then 'Last Product Key in sequence
iProductKey = Mid(rs("Product_Key"), myArray(UBound(myArray)) + 1, iKeyLength - UBound(myArray))
Else
iProductKey = Mid(rs("Product_Key"), myArray(i) - (myArray2(i - 1) - 1), myArray2(i - 1) - 1)
End If
End if
response.write(iProductKey)
Next
rs.MoveNext
Loop
conn.close
set rs = nothing
set conn = nothing
%>
Please shed some light on this..
Thanks
Clarkie
<%
dim conn, rs, sql
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("Nuggit_v1.0.mdb"))
set rs = server.createobject("ADODB.Recordset")
sql = "SELECT * FROM tblRetailer_Product_Key;"
rs.open sql, conn, 3
Dim iStart
Dim iProductKey
Dim iKeyLength
Dim i
Dim myArray()
Dim myArray2()
Dim strCurrComma
Do until rs.EOF
iKeyLength = Len(rs("Product_key"))
For i = 1 To iKeyLength
strCurrComma = Mid(rs("Product_Key"), i, 1)
If strCurrComma = Chr(44) Then
redim myarray(0)
If isarray(myArray) Then
ReDim Preserve myArray(UBound(myArray) + 1)
myArray(UBound(myArray)) = i
Else
ReDim myArray(0)
myArray(UBound(myArray)) = i
End If
End If
Next
For i = 0 To UBound(myArray)
If i > 0 Then
If isarray(myarray2) Then
redim myarray2(0)
ReDim Preserve myArray2(UBound(myArray2) + 1)
myArray2(UBound(myArray2)) = myArray(i) - myArray(i - 1)
Else
ReDim myArray2(0)
myArray2(0) = myArray(0)
End If
End If
Next
For i = 0 To UBound(myArray) + 1
If i = 0 Then 'First Product Key in sequence
iProductKey = Mid(rs("Product_Key"),1, myArray(i) - 1)
Else If i > UBound(myArray) Then 'Last Product Key in sequence
iProductKey = Mid(rs("Product_Key"), myArray(UBound(myArray)) + 1, iKeyLength - UBound(myArray))
Else
iProductKey = Mid(rs("Product_Key"), myArray(i) - (myArray2(i - 1) - 1), myArray2(i - 1) - 1)
End If
End if
response.write(iProductKey)
Next
rs.MoveNext
Loop
conn.close
set rs = nothing
set conn = nothing
%>