ChewDoggie
Programmer
g'morning all!
I have what seems to be the easiest problem to solve, but cannot for the sake of me figure this out. Maybe I need to change coffee brands or something.
Anyway, I have a listview with six columns:
ClassID, Class Description, Bike Abbreviation, Competition Number, Engine Size and BikeID
The ClassID and BikeID fields are not visible to the user. My problem is that I cannot seem to grab the Class Description EVEN THOUGH I can see the darn description on the screen. Here's a code snippet:
ClassDesc = lstHist.ListItems(1).SubItems(0)
BikeAbbr = lstHist.ListItems(1).SubItems(1)
CompNum = lstHist.ListItems(1).SubItems(2)
EngineSize = lstHist.ListItems(1).SubItems(3)
ClassID = lstHist.ListItems(1).SubItems(4)
BikeID = crs!bikeid = lstHist.ListItems(1).SubItems(5)
The Error states "Invalid Property Value" on the ClassDesc line. It seem to me that if I can SEE THE DESCRIPTION, I should be able to grab it programmatically.
Here's how I load the ListView with Data:
sql = "select * from vreghistory where racerid=" & txtRacerid.Text
Set rsHist = New ADODB.Recordset
rsHist.Open sql, cn, adOpenKeyset, adLockReadOnly
lstHist.ListItems.Clear
If rsHist.RecordCount = 0 Then
cmdAddAllClasses.Enabled = False
cmdAddClass.Enabled = False
Else
cmdAddAllClasses.Enabled = True
cmdAddClass.Enabled = True
Do While Not rsHist.EOF
' add the main ListItem object
Set li = lstHist.ListItems.Add(, , rsHist!Description & "")
' add all subsequent ListSubItem objects
li.ListSubItems.Add , , rsHist!brandabr & ""
li.ListSubItems.Add , , rsHist!comp & ""
li.ListSubItems.Add , , rsHist!bikesize & ""
li.ListSubItems.Add , , rsHist!classid
li.ListSubItems.Add , , rsHist!brandid
rsHist.MoveNext
Loop
End If
rsHist.Close
Thanks!
Many Thanks!
AMACycle
American Motorcyclist Association
I have what seems to be the easiest problem to solve, but cannot for the sake of me figure this out. Maybe I need to change coffee brands or something.
Anyway, I have a listview with six columns:
ClassID, Class Description, Bike Abbreviation, Competition Number, Engine Size and BikeID
The ClassID and BikeID fields are not visible to the user. My problem is that I cannot seem to grab the Class Description EVEN THOUGH I can see the darn description on the screen. Here's a code snippet:
ClassDesc = lstHist.ListItems(1).SubItems(0)
BikeAbbr = lstHist.ListItems(1).SubItems(1)
CompNum = lstHist.ListItems(1).SubItems(2)
EngineSize = lstHist.ListItems(1).SubItems(3)
ClassID = lstHist.ListItems(1).SubItems(4)
BikeID = crs!bikeid = lstHist.ListItems(1).SubItems(5)
The Error states "Invalid Property Value" on the ClassDesc line. It seem to me that if I can SEE THE DESCRIPTION, I should be able to grab it programmatically.
Here's how I load the ListView with Data:
sql = "select * from vreghistory where racerid=" & txtRacerid.Text
Set rsHist = New ADODB.Recordset
rsHist.Open sql, cn, adOpenKeyset, adLockReadOnly
lstHist.ListItems.Clear
If rsHist.RecordCount = 0 Then
cmdAddAllClasses.Enabled = False
cmdAddClass.Enabled = False
Else
cmdAddAllClasses.Enabled = True
cmdAddClass.Enabled = True
Do While Not rsHist.EOF
' add the main ListItem object
Set li = lstHist.ListItems.Add(, , rsHist!Description & "")
' add all subsequent ListSubItem objects
li.ListSubItems.Add , , rsHist!brandabr & ""
li.ListSubItems.Add , , rsHist!comp & ""
li.ListSubItems.Add , , rsHist!bikesize & ""
li.ListSubItems.Add , , rsHist!classid
li.ListSubItems.Add , , rsHist!brandid
rsHist.MoveNext
Loop
End If
rsHist.Close
Thanks!
Many Thanks!
AMACycle
American Motorcyclist Association