[AccessD] rs.recordcount

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Fri Feb 7 14:54:00 CST 2003


I am checking when was the last working day - here's what I got --


Private Function CheckCurrentDate()
Dim dbs As Database, rs As DAO.Recordset, i As Integer
    myReportDate = IIf((Weekday(Date - 1) = vbSunday), Date - 3, IIf((Date
- 1) = vbSaturday, Date - 2, Date - 1))
    'Checks if the last business day was equal a holiday

    Set dbs = CurrentDb
    Set rs = dbs.OpenRecordset("tblHoliday")

    For i = 1 To rs.RecordCount  'Counts total records in tblHoliday
        If myReportDate = rs![Date] Then

            myReportDate = IIf(Weekday(myReportDate - 1) = vbSunday,
(myReportDate - 3), _
                IIf(Weekday(myReportDate - 1) = vbSaturday, (myReportDate
- 2), (myReportDate - 1)))

            Exit Function
        End If
    rs.MoveNext
    Next i
    rs.Close
End Function

----------------------------


    For i = 1 To rs.RecordCount  'Counts total records in tblHoliday
        If myReportDate = rs![Date] Then

this line is giving me an error; why is it ? i thought that it is correct
synthaxis
(i had to change to "  For i = 1 To 10  " for know...



-----------------------------------------
Send a Xuppa Valentine to Your Sweetheart today!
http://www.xuppa.com/greet/





More information about the AccessD mailing list