B
Brian Piotrowski
Hi All,
I've probably done this before, but for the life of me I can't remember how
I did it. I need to move values from a DB table into an array to be used
for other queries. The number of records will vary, so I need to make the
array dynamic. Can someone remind me how I can increment the index when I
write a new record? Here's a sample of the code I wrote:
If rsGETKD.EOF = False Then
Dim KDLOTSQ
KDLOTSQ = rsGETKD.GetRows()
iRecFirst = LBound(KDLOTSQ, 2)
iRecLast = UBound(KDLOTSQ, 2)
iFieldFirst = LBound(KDLOTSQ, 1)
iFieldLast = UBound(KDLOTSQ, 1)
Dim KDLTable
MyCount = 0
For I = iRecFirst To iRecLast
MyText=""
For J = iFieldFirst To iFieldLast
MyText=MyText & KDLOTSQ(J, I)
Next
KDLTable(MyCount) = MyText
MyCount = MyCount + 1
Next
End If
What this code is supposed to do is read a DB table that contains two
values. These two values are written to another array (KDLTable) that I can
use as a reference later on in my ASP (I need to read this table four times
at four different record locations).
When I run this code, I get an "800a000d Type Mismatch" Error. Looking at
the code, the program breaks at "KDLTable(MyCount) = MyText". I'm sure the
program is failing when the system tries to use MyCount as the index number.
How can I increment the index number for each value in the table? For
example, if there are three records in the table, (ABC123, DEF456 and
GHI789), I would like to write in this manner:
KDLTable(0) = ABC123
KDLTable(1) = DEF456
KDLTable(2) = GHI789
Any ideas would be appreciated.
Thanks!
Brian.
I've probably done this before, but for the life of me I can't remember how
I did it. I need to move values from a DB table into an array to be used
for other queries. The number of records will vary, so I need to make the
array dynamic. Can someone remind me how I can increment the index when I
write a new record? Here's a sample of the code I wrote:
If rsGETKD.EOF = False Then
Dim KDLOTSQ
KDLOTSQ = rsGETKD.GetRows()
iRecFirst = LBound(KDLOTSQ, 2)
iRecLast = UBound(KDLOTSQ, 2)
iFieldFirst = LBound(KDLOTSQ, 1)
iFieldLast = UBound(KDLOTSQ, 1)
Dim KDLTable
MyCount = 0
For I = iRecFirst To iRecLast
MyText=""
For J = iFieldFirst To iFieldLast
MyText=MyText & KDLOTSQ(J, I)
Next
KDLTable(MyCount) = MyText
MyCount = MyCount + 1
Next
End If
What this code is supposed to do is read a DB table that contains two
values. These two values are written to another array (KDLTable) that I can
use as a reference later on in my ASP (I need to read this table four times
at four different record locations).
When I run this code, I get an "800a000d Type Mismatch" Error. Looking at
the code, the program breaks at "KDLTable(MyCount) = MyText". I'm sure the
program is failing when the system tries to use MyCount as the index number.
How can I increment the index number for each value in the table? For
example, if there are three records in the table, (ABC123, DEF456 and
GHI789), I would like to write in this manner:
KDLTable(0) = ABC123
KDLTable(1) = DEF456
KDLTable(2) = GHI789
Any ideas would be appreciated.
Thanks!
Brian.