如何设置组合框或列表框的行来源为函数(2)
如何设置组合框或列表框的行来源为函数(2)ReDim svarArray(sintRows, sintCols)
For intLoopRow = 0 To sintRows - 1
svarArray(intLoopRow, 0) = RST(0)
svarArray(intLoopRow, 1) = RST(1)
' MsgBox rst(0) & rst(1)
RST.MoveNext
Next
RST.Close
End If
varRetVal = True
Case acLBOpen '1
'return a unique ID code
varRetVal = Timer
Case acLBGetRowCount '3
' Return number of rows
varRetVal = sintRows
Case acLBGetColumnCount '4
' Return number of fields (columns)
varRetVal = sintCols
Case acLBGetColumnWidth '5
'return the column widths or
'-1 for the default width for the column
' varRetVal = -1 'default width
Select Case lngCol
Case 0
'hide the first column
varRetVal = 0
Case 1
'return the default width for column 2
varRetVal = -1
End Select
Case acLBGetValue '6
'Return actual data
varRetVal = svarArray(lngRow, lngCol)
'If lngRow = 0 Then
'varRetVal = Null
' End If
Case acLBGetFormat '7
'return the formatting info for the row/column
Select Case lngCol
Case 0
Case 1
End Select
Case acLBEnd '9
'clean up
On Error Resume Next
Erase svarArray
Set RST = Nothing
Set cnn = Nothing
End Select
Proc_exit:
On Error Resume Next
valueList = varRetVal
Exit Function
Proc_err:
'MsgBox Err.Number & "--" & Err.Description & vbCrLf & "CustomerList"
varRetVal = False
Resume Proc_exit
End Function
页:
[1]