sub5
Programmer
- Oct 12, 2005
- 104
Hi All
I have a user-defined function (fnclistbox) filling a listbox. I want it to populate all the rows and all fields from a recordset. I can get all the rows but how do i get all the fields? Presumably it is something to do with the line "fnclistbox = rst!Engine" in the code below.
I have no acLBGetColumnCount case statement in the code element as I have put 5 as the number of columns in my listbox properties.
Case acLBGetValue
On Error Resume Next
Debug.Print "lngRow:" & lngRow
Debug.Print "lngPreviousRow:" & lngPreviousRow
lngMove = lngRow - lngPreviousRow
Debug.Print "lngMove:" & lngPreviousRow
Debug.Print "varBM:" & varBM
rst.Move lngMove, varBM
varBM = rst.Bookmark
If Err = 0 Then
lngPreviousRow = lngRow
fnclistbox = rst!Engine
Else
fnclistbox = Null
End If
On Error GoTo 0 'start again
I have a user-defined function (fnclistbox) filling a listbox. I want it to populate all the rows and all fields from a recordset. I can get all the rows but how do i get all the fields? Presumably it is something to do with the line "fnclistbox = rst!Engine" in the code below.
I have no acLBGetColumnCount case statement in the code element as I have put 5 as the number of columns in my listbox properties.
Case acLBGetValue
On Error Resume Next
Debug.Print "lngRow:" & lngRow
Debug.Print "lngPreviousRow:" & lngPreviousRow
lngMove = lngRow - lngPreviousRow
Debug.Print "lngMove:" & lngPreviousRow
Debug.Print "varBM:" & varBM
rst.Move lngMove, varBM
varBM = rst.Bookmark
If Err = 0 Then
lngPreviousRow = lngRow
fnclistbox = rst!Engine
Else
fnclistbox = Null
End If
On Error GoTo 0 'start again