I use the following code to generate a listbox populated with item and version info. I want to provide a tickbox that I can use to say that a new version has been issued, but I don't know how to do it, and can't find where it is addressed in VBA.
I am coding on office Pro 2003
I am coding on office Pro 2003
Code:
Private Sub popCurItems()
Dim lstItem As ListItem
Dim item() As String
Dim i As Integer
Dim FirstName As String
Dim LastName As String
Dim Company As String
'next 3 lines will be replaced with a person ID number
FirstName = Forms!People.CntName.column(1)
LastName = Forms!People.CntName.column(2)
Company = Forms!Company.Company
Call connectDB 'connection strings to connect to MySQL
SQLout = "select count(Item) from ItemVer where Item not like 'Dongle' and Item not like 'Not Issued'"
Call getData 'gets number of tracked items
ReDim item(rst.Fields(0) - 1)
SQLout = "select Item from ItemVer where Item not like 'dongle' and Item not like 'Not Issued';"
Call getData 'gets all item names except those where multiple items are issued and tracked
i = 0
If Not rst.EOF Then
rst.MoveFirst
Do
item(i) = rst.Fields(0)
i = i + 1
rst.MoveNext
Loop Until rst.EOF
End If
'format my listbox (CurItems)
With Me.CurItems
.View = lvwReport
.GridLines = True
.FullRowSelect = True
.ListItems.Clear
.ColumnHeaders.Clear
.Width = 4800
End With
'Place column headers
With Me.CurItems.ColumnHeaders
.Add , , "Item Name", 3000, lvwColumnLeft
.Add , , "Issued Version", 1500, lvwColumnRight
.Add , , "Issue Code", 0, lvwColumnRight
End With
For i = 0 To UBound(item)
SQLout = ""
SQLout = SQLout & "call IsCurrent('" & FirstName & "','" & LastName
SQLout = SQLout & "','" & Company & "','" & item(i) & "');"
Call getData 'subroutine to grab data from MySQL stored procedure
rst.MoveFirst
Do Until rst.EOF
Set lstItem = Me.CurItems.ListItems.Add()
lstItem.Text = Nz(item(i))
lstItem.SubItems(1) = Nz(rst.Fields(1))
lstItem.SubItems(2) = Nz(rst.Fields(0))
rst.MoveNext
Loop
Next i
cn.CLose
Call format 'calls a sub to do conditional formatting off of "Issue Code"
End Sub