Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListView Control in VBA for MS Access

Status
Not open for further replies.

antigone

Programmer
Dec 11, 2002
1
US
Has anyone used the listview control in VBA for Access? I'm having trouble getting the data to display all across in a single row. Instead it steps down like stairs. This is the code I tried using but it gives me an error, "Object doesn't support this property or method", on the Set LIX line.

Dim LIX As ListItem
Dim rsDisk As Recordset
Dim iCount As Integer


lvwList.ListItems.Clear
lvwList.ColumnHeaders.Clear
Set rsDisk = Application.CurrentDb.OpenRecordset("tbl_P48_Diskette")

For iCount = 0 To rsDisk.Fields.Count - 1
lvwList.ColumnHeaders.Add , , rsDisk.Fields(iCount).Name
Next

Do While Not rsDisk.EOF
For iCount = 0 To rsDisk.Fields.Count - 1
If iCount = 0 Then
Set LIX = lvwList.ListItem.Add
LIX.Text = rsDisk.Fields(iCount).value & ""
Else
LIX.SubItems(iCount) = rsDisk.Fields(iCount).value & ""
End If
Next
rsDisk.MoveNext
Loop
rsDisk.Close
Set rsDisk = Nothing
 
Shouldn't it be Set LIX = lvwList.ListItems.Add?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top