Listview

murthyspd

Registered User.
Local time
Tomorrow, 04:44
Joined
Aug 3, 2006
Messages
31
Hi
I have a list view on my MS access form. I want to add items to it, but I do not see ListItem property when i type

Set LstItem = listview4.

Is there any other setting I need to do ?

Regards
Murthy
 
I have a list view on .....
I asume you mean that you have a List Box control.
List Box controls are often populated with data from a table/query. If this is the case you will need to add the new data to the table and then requery the List Box.
If it is populated from a list of values, shown in its Row Source property, then you can add to this list with code, something like:
Me.NameOfListbox.RowSource = Me.NameOfListbox.RowSource & "ItemToAdd;"
 
'by jay
Private Sub PopulateListView()
On Error Resume Next
Lst_addsite.ListItems.Clear

Set dbs = CurrentDb
strSQL = "SELECT * FROM temp_addsite Order By Site_No"
Set temprs = dbs.OpenRecordset(strSQL, dbOpenSnapshot)


If temprs.RecordCount > 0 Then
temprs.MoveFirst
Do Until temprs.EOF
Set lstitem = Lst_addsite.ListItems.Add(, , temprs("Site_No"))
lstitem.SubItems(1) = temprs("Site_Name")
lstitem.SubItems(2) = temprs("Area")
lstitem.SubItems(3) = temprs("Quantity")
lstitem.SubItems(4) = temprs("Address")
lstitem.SubItems(5) = temprs("ID_Number")
On Error Resume Next 'continue even in error
temprs.MoveNext
Set lstitem = Nothing
Loop
End If

Set temprs = Nothing


this my code,,try it... it works on my listview in msaccess
dim lstitem as listitem
 

Users who are viewing this thread

Back
Top Bottom