Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. listview won't display data populated in vb6

listview won't display data populated in vb6

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dave 10169531
    wrote on last edited by
    #1

    This is now solved. I can walk the code through and watch the data populate but nothing other than the headings are displayed. I am not sure what is different with this compared to others that have been done and i have even compared code and they all work the same so there must be something i am over looking.

    Dim nUserID As Long
    Dim sToday As String
    Dim sUser As String
    Dim sSQL As String

    Dim li      As ListItem
    
    Me.lvMain.ListItems.Clear
    
    'rsUser.MoveFirst
    
    Set dbGlob = OpenDatabase(GenPath & "WORORDGB.MDB")
    'Set rsCal = Nothing
    sToday = sDate
    Select Case UCase(sType)
    
        Case "ALL"            'All
            
            sSQL = "SELECT \* FROM \[Accum\] WHERE \[Type\] = 'LABOR' AND \[Closed\]= 0 AND \[WOCounter\] <> 0 ORDER BY \[Date\],\[UserID\],\[Start\],\[WOCounter\]"
            Set rsCal = dbGlob.OpenRecordset(sSQL)
            rsCal.MoveLast
            rsCal.MoveFirst
            
        Case "WO"      'WO
        
            Set rsCal = dbGlob.OpenRecordset("SELECT \* FROM \[Accum\] WHERE \[Type\] = 'LABOR' AND \[Closed\]= 0 AND \[WOCounter\] = " & CInt(Trim(Me.cmbWOID.Text)) & " ORDER BY \[Date\],\[UserID\],\[Start\],\[WOCounter\]")
            rsCal.MoveLast
            rsCal.MoveFirst
        
        Case "WR"          'WORKER
        
            Set rsCal = dbGlob.OpenRecordset("SELECT \* FROM \[Accum\] WHERE \[Type\] = 'LABOR' AND \[Closed\]= 0 AND \[WOCounter\] <> 0 AND \[UserID\]=" & CLng(Me.cmbuserID.Text) & " ORDER BY \[Date\],\[UserID\],\[Start\],\[WOCounter\]")
            rsCal.MoveLast
            rsCal.MoveFirst
        
        Case "WRWO"         'Worker - WO
        
            Set rsCal = dbGlob.OpenRecordset("SELECT \* FROM \[Accum\] WHERE \[Type\] = 'LABOR' AND \[Closed\]= 0 AND \[WOCounter\] = " & CInt(Trim(Me.cmbWOID.Text)) & " AND \[UserID\]=" & CLng(Me.cmbuserID.Text) & " ORDER BY \[Date\],\[UserID\],\[Start\],\[WOCounter\]")
            rsCal.MoveLast
            rsCal.MoveFirst
    
    End Select
    
    With Me.lvMain
        '.ListItems.Clear
        If rsCal.RecordCount = 0 Then
            Set li = .ListItems.Add(1, "ID" & rsUser.Fields("ID").Value, "Empty", , 4)
            Exit Sub
        End If
        
        For X = 1 To rsCal.RecordCount
                
            If IsNull(rsCal.Fields("UserID").Value) Then
                sUser = rsCal.Fields("Desc").Value
            Else
                For Y = 0 To cmbUser.ListCount - 1
                    If CLng(rsCal.Fields("UserID").Val
    
    T 1 Reply Last reply
    0
    • D Dave 10169531

      This is now solved. I can walk the code through and watch the data populate but nothing other than the headings are displayed. I am not sure what is different with this compared to others that have been done and i have even compared code and they all work the same so there must be something i am over looking.

      Dim nUserID As Long
      Dim sToday As String
      Dim sUser As String
      Dim sSQL As String

      Dim li      As ListItem
      
      Me.lvMain.ListItems.Clear
      
      'rsUser.MoveFirst
      
      Set dbGlob = OpenDatabase(GenPath & "WORORDGB.MDB")
      'Set rsCal = Nothing
      sToday = sDate
      Select Case UCase(sType)
      
          Case "ALL"            'All
              
              sSQL = "SELECT \* FROM \[Accum\] WHERE \[Type\] = 'LABOR' AND \[Closed\]= 0 AND \[WOCounter\] <> 0 ORDER BY \[Date\],\[UserID\],\[Start\],\[WOCounter\]"
              Set rsCal = dbGlob.OpenRecordset(sSQL)
              rsCal.MoveLast
              rsCal.MoveFirst
              
          Case "WO"      'WO
          
              Set rsCal = dbGlob.OpenRecordset("SELECT \* FROM \[Accum\] WHERE \[Type\] = 'LABOR' AND \[Closed\]= 0 AND \[WOCounter\] = " & CInt(Trim(Me.cmbWOID.Text)) & " ORDER BY \[Date\],\[UserID\],\[Start\],\[WOCounter\]")
              rsCal.MoveLast
              rsCal.MoveFirst
          
          Case "WR"          'WORKER
          
              Set rsCal = dbGlob.OpenRecordset("SELECT \* FROM \[Accum\] WHERE \[Type\] = 'LABOR' AND \[Closed\]= 0 AND \[WOCounter\] <> 0 AND \[UserID\]=" & CLng(Me.cmbuserID.Text) & " ORDER BY \[Date\],\[UserID\],\[Start\],\[WOCounter\]")
              rsCal.MoveLast
              rsCal.MoveFirst
          
          Case "WRWO"         'Worker - WO
          
              Set rsCal = dbGlob.OpenRecordset("SELECT \* FROM \[Accum\] WHERE \[Type\] = 'LABOR' AND \[Closed\]= 0 AND \[WOCounter\] = " & CInt(Trim(Me.cmbWOID.Text)) & " AND \[UserID\]=" & CLng(Me.cmbuserID.Text) & " ORDER BY \[Date\],\[UserID\],\[Start\],\[WOCounter\]")
              rsCal.MoveLast
              rsCal.MoveFirst
      
      End Select
      
      With Me.lvMain
          '.ListItems.Clear
          If rsCal.RecordCount = 0 Then
              Set li = .ListItems.Add(1, "ID" & rsUser.Fields("ID").Value, "Empty", , 4)
              Exit Sub
          End If
          
          For X = 1 To rsCal.RecordCount
                  
              If IsNull(rsCal.Fields("UserID").Value) Then
                  sUser = rsCal.Fields("Desc").Value
              Else
                  For Y = 0 To cmbUser.ListCount - 1
                      If CLng(rsCal.Fields("UserID").Val
      
      T Offline
      T Offline
      Tim Carmichael
      wrote on last edited by
      #2

      Initial suggestion: divide and conquer. Is is the listview or the data? Try building your listview using other data; say, the numbers 1 to 10 and see what happens. Also, try writing the database data to a text field, a file or the console window. Enjoy you're getting data when NOT in debug mode. If they both work independently, then we can look at it again. Having said that, VB 6 is no longer supported; consider moving to .NET. There are free versions available for download (VB.NET Express).

      D 1 Reply Last reply
      0
      • T Tim Carmichael

        Initial suggestion: divide and conquer. Is is the listview or the data? Try building your listview using other data; say, the numbers 1 to 10 and see what happens. Also, try writing the database data to a text field, a file or the console window. Enjoy you're getting data when NOT in debug mode. If they both work independently, then we can look at it again. Having said that, VB 6 is no longer supported; consider moving to .NET. There are free versions available for download (VB.NET Express).

        D Offline
        D Offline
        Dave 10169531
        wrote on last edited by
        #3

        Thanks I am sorry i thought i deleted this thread. I did resolve the problem. And yes I am migrating the complete application to newer code base using VS2013. Thanks again

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups