J
Jason
Hi,
Could somebody help me make the following code to be used as a function? I
want to call it in every form where i have listboxes or comboboxes. The
source of the recordset should also come from a function.
Public Function Filler()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strValueList As String
Set cnn = GetConnection(True)
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = cnn
.Source = <function?>
.Open
Do Until .EOF
strValueList = strValueList & rst.Fields("field1") & ";" & _
rst.Fields("field2") & ";"
.MoveNext
Loop
End With
With lstcmb
.RowSourceType = "Value List"
.RowSource = strValueList
End With
rst.Close
Set rst = Nothing
cnn.Close
Set cnn = Nothing
End Function
Could somebody help me make the following code to be used as a function? I
want to call it in every form where i have listboxes or comboboxes. The
source of the recordset should also come from a function.
Public Function Filler()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strValueList As String
Set cnn = GetConnection(True)
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = cnn
.Source = <function?>
.Open
Do Until .EOF
strValueList = strValueList & rst.Fields("field1") & ";" & _
rst.Fields("field2") & ";"
.MoveNext
Loop
End With
With lstcmb
.RowSourceType = "Value List"
.RowSource = strValueList
End With
rst.Close
Set rst = Nothing
cnn.Close
Set cnn = Nothing
End Function