msmeth
12-22-2003, 06:39 AM
Good morning all. In my current project, you can click on an item in a listview and that item gets displayed in a form. I'd like to be able to then scroll through each item that was in the listview in form view mode. This is how I populated my listview (its populated based on whatever is clicked in a treeview):
Private Sub SetListView(EqnumID)
lvwDB.View = lvwReport
lvwDB.ListItems.Clear
With rsALL
If .State = adStateOpen Then .Close
.Open SQL
End With
Do Until rsALL.EOF
' Add ListItems
Set lvnode = lvwDB.ListItems.Add(, , rsALL!WONUM)
lvnode.Key = rsALL!WONUM & " ID"
lvnode.SubItems(1) = "" & rsALL!TASKDESC
lvnode.SubItems(2) = "" & rsALL!Status
lvnode.SubItems(3) = "" & rsALL!schedstartdate
lvnode.SubItems(4) = "" & rsALL!ORIGINATOR
lvnode.SubItems(5) = "" & rsALL!REQUESTDATE
lvnode.SubItems(6) = "" & rsALL!Description
lvnode.SubItems(7) = "" & rsALL!TEXTS
rsALL.MoveNext
Loop
End Sub
You double click on the item in the listview and this code fills up the form text boxes:
Private Sub lvwdb_DblClick()
frmeINFO.Visible = True
For i = 1 To lvwDB.ListItems.Count
If lvwDB.ListItems(i).Selected = True Then
Exit For
End If
Next i
If i <= lvwDB.ListItems.Count Then
txtWOinfo(0).Text = lvwDB.ListItems(i)
For j = 1 To 7
txtWOinfo(j).Text = lvwDB.ListItems(i).SubItems(j)
Next j
End If
cmdEXIT.ZOrder (0)
End Sub
Can someone help me create the Prev/Next/First/Last navigation buttons for while you're in the form view please? I don't know if I can use the .MoveNext and simliar methods since the textboxes are actually tied to the listview and not the recordset itself.
Private Sub SetListView(EqnumID)
lvwDB.View = lvwReport
lvwDB.ListItems.Clear
With rsALL
If .State = adStateOpen Then .Close
.Open SQL
End With
Do Until rsALL.EOF
' Add ListItems
Set lvnode = lvwDB.ListItems.Add(, , rsALL!WONUM)
lvnode.Key = rsALL!WONUM & " ID"
lvnode.SubItems(1) = "" & rsALL!TASKDESC
lvnode.SubItems(2) = "" & rsALL!Status
lvnode.SubItems(3) = "" & rsALL!schedstartdate
lvnode.SubItems(4) = "" & rsALL!ORIGINATOR
lvnode.SubItems(5) = "" & rsALL!REQUESTDATE
lvnode.SubItems(6) = "" & rsALL!Description
lvnode.SubItems(7) = "" & rsALL!TEXTS
rsALL.MoveNext
Loop
End Sub
You double click on the item in the listview and this code fills up the form text boxes:
Private Sub lvwdb_DblClick()
frmeINFO.Visible = True
For i = 1 To lvwDB.ListItems.Count
If lvwDB.ListItems(i).Selected = True Then
Exit For
End If
Next i
If i <= lvwDB.ListItems.Count Then
txtWOinfo(0).Text = lvwDB.ListItems(i)
For j = 1 To 7
txtWOinfo(j).Text = lvwDB.ListItems(i).SubItems(j)
Next j
End If
cmdEXIT.ZOrder (0)
End Sub
Can someone help me create the Prev/Next/First/Last navigation buttons for while you're in the form view please? I don't know if I can use the .MoveNext and simliar methods since the textboxes are actually tied to the listview and not the recordset itself.