In Access the control on the form is a container for the activex OBJECT
(capitalised to emphasise the word).
So with a listview you could do the following
PUt a listview control (ListView0) and a command button (Command1) on a
form, add the fllowing code and change the select statement as appropriate.
Private Sub Command1_Click()
Call FillList
End Sub
Private Sub FillList()
Dim lv As MSComctlLib.ListView
Dim loCon As ADODB.Connection
Dim loRst As ADODB.Recordset
' Note: here we're testing assigning from the object property of the control
If TypeOf Me.ListView0.Object Is MSComctlLib.ListView Then
Set lv = Me.ListView0.Object
Set loCon = Access.CurrentProject.Connection
Set loRst = loCon.Execute("Select * from MyTable")
With lv
.ColumnHeaders.Add Text:="a"
.View = lvwReport
End With
With loRst
Do Until .EOF
lv.ListItems.Add Text:=.Fields(0) & ""
.MoveNext
Loop
End With
End If
Set lv = Nothing
End Sub
--
Terry Kreft
MVP Microsoft Access
"Geir Baardsen" <ge***********@hotmail.com> wrote in message
news:35**************************@posting.google.c om...
Hi!
The default ListBox control in ms access 2000 can't show the
gridlines. I could "fake" it by setting the listbox Special effect to
'Flat' and Font to underline, but this is not good enough for a user
that needs glasses. Also I need to use a very small font, ms sans
serif size 8, because of trillions of records.
Can anybody show how to retrieve data from a table and fill the
lstViewCtl, which is an ActiveX control, with data.
I know how to do this with the equivalent in Delphi 6, and I have
tried to follow that pattern. However...The Microsoft ActiveX control
seem to have a different approach.
I can't seem to find a way to access the columnHeader or anything but
the 'name' property.
So, anybody..?
Me.Name