mferrisi
04-16-2007, 06:55 AM
I run this query for several accounts and then find a value for 'Other'. However, in a new account, there is only one 1 set of data returned, meaning my ubound is 4. Thus, when I run the FOR loop, I recieve an error.
Is there an easy way to make it so that I can handle a 1 by 4 array? (All of the other accounts produce an array of 1 to 4, 1 to about 400, so the ubound method is fine.)
Sub End_MV(Name As String, EndDate, YearRange As Range)
Dim TempM()
Dim TempW()
Dim qrs
Dim tuv As Integer
Dim Other As Double
databasename = DbConnectionHF
querystring = "SELECT history.name, history.hist_date, history.invest_type, history.other_assets_mny FROM DATABASE..history history WHERE (history.name ='" & Name & "')"
TempW = sqlrequest(databasename, querystring, , 4, False)
vb = UBound(TempW, 1)
For tuv = 1 To vb
If TempW(tuv, 2) = EndDate And TempW(tuv, 3) = "something" Then
Other = TempW(tuv, 4)
Exit For
End If
Next tuv
Is there an easy way to make it so that I can handle a 1 by 4 array? (All of the other accounts produce an array of 1 to 4, 1 to about 400, so the ubound method is fine.)
Sub End_MV(Name As String, EndDate, YearRange As Range)
Dim TempM()
Dim TempW()
Dim qrs
Dim tuv As Integer
Dim Other As Double
databasename = DbConnectionHF
querystring = "SELECT history.name, history.hist_date, history.invest_type, history.other_assets_mny FROM DATABASE..history history WHERE (history.name ='" & Name & "')"
TempW = sqlrequest(databasename, querystring, , 4, False)
vb = UBound(TempW, 1)
For tuv = 1 To vb
If TempW(tuv, 2) = EndDate And TempW(tuv, 3) = "something" Then
Other = TempW(tuv, 4)
Exit For
End If
Next tuv