hey
when i try to refresh a form i get en error
"item cannot be found in the collection corresponding to the requested name or ordinal"
why is that?
is there a sql statment instead? or missing i dont know you judje:confused:
when i try to refresh a form i get en error
"item cannot be found in the collection corresponding to the requested name or ordinal"
why is that?
is there a sql statment instead? or missing i dont know you judje:confused:
Code:
Sub Loadentries()
Frame1.Visible = True
LsVw.Enabled = False
TxtFind.Enabled = False
Me.MousePointer = vbHourglass
TxtFind.text = ""
LsVw.ListItems.clear
Set RS = New ADODB.Recordset
RS.Open "SELECT * FROM Logs ORDER BY LogId", CN, adOpenKeyset
prgbar.Max = RS.RecordCount
If RS.RecordCount > 0 Then
prgbar.Value = 1
While Not RS.EOF
Set Itm = FrmSecurityreport.LsVw.ListItems.Add(, , RS!LogId, , "report")
Itm.Tag = RS!LogId
Itm.bold = True
Itm.SubItems(1) = RS!LogDate
Itm.SubItems(2) = RS!LogDay
Itm.SubItems(3) = RS!LogName
Itm.SubItems(4) = RS!LogIn
Dim daDate1 As Date
Dim daDate2 As Date
Dim intMins As Integer
Dim intHrs As Integer
If Not IsNull(RS![logout]) Then
'
' If there's a Logout time then
' check if the LogTotal has been calculated
'
Itm.SubItems(5) = RS![logout]
If IsNull(RS![LogTotal]) Then
'
' Calculate LogTotal
'
daDate1 = CDate(Itm.SubItems(4))
daDate2 = CDate(Itm.SubItems(5))
intMins = DateDiff("n", daDate1, daDate2)
intHrs = intMins \ 60
intMins = intMins Mod 60
Itm.SubItems(6) = CStr(intHrs) & ":" & CStr(intMins)
Else
Itm.SubItems(6) = RS![LogTotal]
End If
End If
prgbar.Value = prgbar.Value + 1
RS.MoveNext
DoEvents
Wend
Me.MousePointer = vbNormal
Frame1.Visible = False
LsVw.Enabled = True
TxtFind.Enabled = True
End If
End Sub