sub5
Programmer
- Oct 12, 2005
- 104
Hi all
I am using this code (see below under valuelist to create a string to create a ValueList to fill the rowsource of a combobox. It works fine, except if the number of characters exceeds 2048.
To avoid the 2048 problem I thought I'd try filling the combobox using a userdefined function. I'm floundering with the code below under User defined function:. I am getting the error 9;subscript out of range and debugger goes to line:
inst(entries) = inst1.mstrContractDetlkey
Also how do I make it so that all four fields are included in the cbo list?
ie
mstrContractDetlkey
mstrRateSubFleetID
mstrEngAndRateDesc
mstrAircraftDesc
Thankyou in advance for any comments
ValueList:
Private Function fncAssigne dRateAcraftList()
Dim inst As Variant, strValueList As String
For Each inst In clnCDetlRateList
strValueList = strValueList & inst.mstrContractDetlkey & ";" & inst.mstrRateSubFleetID & ";" & inst.mstrEngAndRateDesc & ";" & inst.mstrAircraftDesc & ";"
Next
Me!lstRateSubFleetID.RowSource = strValueList
End Function
User Defined function:
Private Function fncARAList(fld As control, id As Variant, row As Variant, col As Variant, code As Variant) As Variant
Static inst() As String, entries As Integer
Dim returnVal As Variant
returnVal = Null
Dim inst1 As Variant
Select Case code
Case acLBInitialize
entries = 0
For Each inst1 In clnCDetlRateList
entries = entries + 1
inst(entries) = inst1.mstrContractDetlkey
Next
returnVal = entries
Case acLBOpen
returnVal = timer
Case acLBGetRowCount
returnVal = entries
Case acLBGetColumnCount
returnVal = 4
Case acLBGetColumnWidth
returnVal = -1
Case acLBGetValue
returnVal = inst(row)
Case acLBEnd
Erase inst
End Select
fncARAList = returnVal
End Function
I am using this code (see below under valuelist to create a string to create a ValueList to fill the rowsource of a combobox. It works fine, except if the number of characters exceeds 2048.
To avoid the 2048 problem I thought I'd try filling the combobox using a userdefined function. I'm floundering with the code below under User defined function:. I am getting the error 9;subscript out of range and debugger goes to line:
inst(entries) = inst1.mstrContractDetlkey
Also how do I make it so that all four fields are included in the cbo list?
ie
mstrContractDetlkey
mstrRateSubFleetID
mstrEngAndRateDesc
mstrAircraftDesc
Thankyou in advance for any comments
ValueList:
Private Function fncAssigne dRateAcraftList()
Dim inst As Variant, strValueList As String
For Each inst In clnCDetlRateList
strValueList = strValueList & inst.mstrContractDetlkey & ";" & inst.mstrRateSubFleetID & ";" & inst.mstrEngAndRateDesc & ";" & inst.mstrAircraftDesc & ";"
Next
Me!lstRateSubFleetID.RowSource = strValueList
End Function
User Defined function:
Private Function fncARAList(fld As control, id As Variant, row As Variant, col As Variant, code As Variant) As Variant
Static inst() As String, entries As Integer
Dim returnVal As Variant
returnVal = Null
Dim inst1 As Variant
Select Case code
Case acLBInitialize
entries = 0
For Each inst1 In clnCDetlRateList
entries = entries + 1
inst(entries) = inst1.mstrContractDetlkey
Next
returnVal = entries
Case acLBOpen
returnVal = timer
Case acLBGetRowCount
returnVal = entries
Case acLBGetColumnCount
returnVal = 4
Case acLBGetColumnWidth
returnVal = -1
Case acLBGetValue
returnVal = inst(row)
Case acLBEnd
Erase inst
End Select
fncARAList = returnVal
End Function