[AccessD] rs.recordcount

Stephen Hait shait at mindspring.com
Fri Feb 7 15:19:00 CST 2003


Do you maybe need to first rs.MoveLast, rs.MoveFirst before 
having an accurate RecordCount?

Stephen

> 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/
> 
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com





More information about the AccessD mailing list