After hours of searching on my own for a solution, I have given up & hope that someone can help. I'm just an average VBA person and new to generating the ActiveX Listview and Treeview, but have so far managed to create a form with a Treeview list and an Listview where I can drag items from the Listview object and drop them on an item in the Treeview object. Everything works well EXCEPT that I would like my 3rd column in the Listview to display currency rather than a string value which is left justified.
I have tried inserting several format lines but to no avail. It would be greatly appreciated if someone could guide me on this! Here is the code for the Listview:
==========
Private Sub tvTreeView_NodeClick(ByVal Node As Object)
Dim strSQL As String
Dim nodSelected As Node
Dim tv As TreeView
Dim lv As ListView
Dim rDate As Date
Dim lvItem As MSComctlLib.ListItem
'Ensure that the clicked node equals the selected node in the tree
Set tv = Me.tvTreeView.Object
Set lv = Me.lvOrders.Object
Set nodSelected = Node
Set tv.SelectedItem = nodSelected
nodSelected.Selected = True
'SetupListview
With Me.lvOrders
.GridlineStyleBottom = True
.FullRowSelect = True
.Font.Name = "Verdana"
.Font.Size = 8
End With
'Update the listview box to show the items
strSQL = "SELECT BuildKey(ID) AS ItemKey," & _
" Vendor," & _
" eDate," & _
" Amount" & _
" FROM tblScansR" & _
" WHERE BuildKey(Nz(ItemID, '<Null>')) = '" & tv.SelectedItem.Key & "'" & _
" ORDER BY eDate ASC"
'Build the list view
lv.ListItems.Clear
With CurrentProject.Connection
AddLVItems lv, .Execute(strSQL, , adCmdText), , , "2880,2160"
End With
End Sub
I have tried inserting several format lines but to no avail. It would be greatly appreciated if someone could guide me on this! Here is the code for the Listview:
==========
Private Sub tvTreeView_NodeClick(ByVal Node As Object)
Dim strSQL As String
Dim nodSelected As Node
Dim tv As TreeView
Dim lv As ListView
Dim rDate As Date
Dim lvItem As MSComctlLib.ListItem
'Ensure that the clicked node equals the selected node in the tree
Set tv = Me.tvTreeView.Object
Set lv = Me.lvOrders.Object
Set nodSelected = Node
Set tv.SelectedItem = nodSelected
nodSelected.Selected = True
'SetupListview
With Me.lvOrders
.GridlineStyleBottom = True
.FullRowSelect = True
.Font.Name = "Verdana"
.Font.Size = 8
End With
'Update the listview box to show the items
strSQL = "SELECT BuildKey(ID) AS ItemKey," & _
" Vendor," & _
" eDate," & _
" Amount" & _
" FROM tblScansR" & _
" WHERE BuildKey(Nz(ItemID, '<Null>')) = '" & tv.SelectedItem.Key & "'" & _
" ORDER BY eDate ASC"
'Build the list view
lv.ListItems.Clear
With CurrentProject.Connection
AddLVItems lv, .Execute(strSQL, , adCmdText), , , "2880,2160"
End With
End Sub