RAYMOND HJ
10-08-2000, 10:17 AM
Hi..
I'm still new in VB. I'm having trouble determining how many record are in a recordset that meet specified condition. For example: I want to know how many people that born < 1980. Thank you..
dusteater
10-08-2000, 11:59 PM
OK,
Try this
SQL="SELECT FirstName from MyTable where Birth < 1980" <font color=blue>"this is assuming that your table is named "MyTable" and your data fields are named
"FirstName" and "Birth"</font color=blue>
rs.open sql, cn, adOpenKeyset <font color=blue> " put in your own connection"</font color=blue>
totrecords=rs.RecordCount
that should do the trick!
Rick
TheOnly
10-09-2000, 03:25 AM
Hi !!!
Which version of database engine to you use ?
DBengine (Access97) or ADODB (Access2000)
The reason is, with DBengine there is sometimes a bug with the recordset count.
Therefor you must go to the end (MoveLast) and then to the beginn (MoveFirst) of the recordset to get the correct Count of the records
I don't know if this behavour is also in ADODB
Greetings from Vienna/Austria
RAYMOND HJ
10-09-2000, 06:51 PM
Could you please show me how do you make connection..
Normally I'm using this way..
dim db as database
dim rs as recordset
st db = workspaces(0).opendatabase("C:BIBLIO.MDB")
set rs = db.openrecordset("Titles",dbopenTable)
so how I'm going to use the SQL statement to count how many
title are published in Year < 1990. Please help me...
Thanks