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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access: ListView ItemClick

Status
Not open for further replies.

AnotherRookie

Technical User
May 11, 2014
3
CH
Guys, I need some help as I am a real rookie in MS Access programming and is currently struggling with a ListView issue. I am populating the listview from a table and want to create the functionality to click or double click on a row upon which it then opens a dialog box in which I enter a value that is then saved in the first subitem of the selected row. I managed to get to the point where open the dialog box when an item is clicked using ListView_ItemClick(...). But, what do I need to do in order to identify the exact row selected and then enter the new value into the subitems(0)? I hope you understand what I am asking because I am also not sure about the terminology.
 
No, I created a form, and in this form I have a ComboBox (Product list) and ListView (List of workstations and sections) with three columns. The product selection in the Combobox fills the listview with values of workstations and sections. The user then needs selects a number of these rows and each row must be assigned a sequence number that will be used to determine the production path in the manufacturing process. The number of workstation vary from product to product and I thought that a ListView would work best. But, as you clearly know it is quite difficult for an inexperienced programmer.
 
Okay, using the following I manage to read the row's subitems. But, Trying to write to the first subitem gives me and error.
Private Sub ListView4_DblClick()
Dim ObjList As ListView
Dim objItem As ListItem
Set ObjList = Me.ListView4.Object
Set objItem = ObjList.ListItems.Add()
[highlight #FCE94F] objItem.SubItems(0) = "1"[/highlight]
MsgBox ObjList.SelectedItem.SubItems(1) & ObjList.SelectedItem.SubItems(2)
End Sub
 
Pretty sure you need to add the sub item first. You are assigning a value but it does not exist yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top