[AccessD] rs.recordcount

Wortz, Charles CWortz at tea.state.tx.us
Fri Feb 7 15:04:07 CST 2003


Oleg,

Two things.  1. What is the error you are getting?  We are not
mindreaders.  2. "Date" is a reserved word and should not be a field
name of your recordset.

Charles Wortz
Software Development Division
Texas Education Agency
1701 N. Congress Ave
Austin, TX 78701-1494
512-463-9493
CWortz at tea.state.tx.us
(SELECT * FROM users WHERE clue > 0)


-----Original Message-----
From: Oleg_123 at xuppa.com [mailto:Oleg_123 at xuppa.com] 
Sent: Friday 2003 Feb 07 14:53
To: accessd at databaseadvisors.com
Subject: [AccessD] rs.recordcount

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...



More information about the AccessD mailing list