Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Am trying to create a form that displays userlog. below is my sub routine; DisplayUserLog. Am getting the following error at runtime: Run-time error '-2147217900 (80040e14)': incorrect syntax...

VB
Sub DisplayUserLog(lstLog As ListView, mDate As Date)
Dim lstItem As ListItem, a As Integer
If Rs.State = adStateOpen Then Rs.Close
   sql = " Select * From Userlog Where (Userlog.Date)=#" & mDate & "#"
   Rs.Open sql, RSconn
   lstLog.ListItems.Clear
   Do While Not Rs.EOF
    a = a + 1
        Set lstItem = lstLog.ListItems.Add(, , a)
            lstItem.SubItems(1) = Rs(1).Value
            lstItem.SubItems(2) = Rs(2).Value
             If IsNull(Rs(3).Value) Then
                lstItem.SubItems(3) = ""
             Else
                lstItem.SubItems(3) = Rs(3).Value
             End If
            lstItem.SubItems(4) = Rs(4).Value
            Rs.MoveNext
            Loop
End Sub
Posted
Updated 12-Apr-13 21:31pm
v4
Comments
Leo Chapiro 13-Apr-13 3:02am    
Set lstItem = lstLog.ListItems.Add(, , a) looks strange
Aleu Philip 13-Apr-13 3:12am    
a way of adding new values to the list at runtime

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900