rs.RecordCount

hi all
i open an access database from asp .. for some reason i need to know the number of records in the recordset before processing it as follows :

set con=Server.CreateObject("Adodb.Connection")
set rs=Server.CreateObject("Adodb.Recordset")
con.ConnectionString=strCon
con.CursorLocation=1 'server
con.Open
set rs.ActiveConnection=con
rs.CursorType=adOpenKeySet
rs.open "select * from items"
rs.MoveLast
n=rs.RecordCount
Response.Write n

i get an error :

Microsoft OLE DB Provider for ODBC Drivers (0x80040E24)
Rowset does not support fetching backward.

can you help with this ?
[669 byte] By [hspc] at [2007-11-18 3:02:46]
# 1 Re: rs.RecordCount
Instead of

rs.CursorType=adOpenKeySet
rs.open "select * from items"

try

rs.CursorType=adOpenStatic
rs.open "select * from items"

see if it works. If others fail this usually willk do it.
antares686 at 2007-11-9 13:33:10 >
# 2 Re: rs.RecordCount
Hi..
I changed the driver in the connection string from
Microsoft access
to:
Jet 4.0
and it worked !!
hspc at 2007-11-9 13:34:10 >