ms access - RecordCont returns the pointer to current record and not the number frecords -


i'm working on access 2003. in routine called click in form button , tried retrive result of query make operation them. in every place ( ms online documentation) explained retrive number of record in recordset u must use recordcount metod on recordset instance. wonder why executing following code obtain number of current position of cursor; also, why record set not filtered ?

dim db dao.database dim rs dao.recordset set db = currentdb() set rs = db.openrecordset("query42") dim idimp integer dim x integer  x = rs.recordcount 'x= 1 (rs pints first record)  rs.filter = "[idimp]= 125 "  ' move first , last ' understend happens in recordset , make test on recordcount  rs.movefirst     x = rs.recordcount 'x= 1 (rs points first record)  rs.movelast      x = rs.recordcount 'x= 1234 (rs points last record)  ' have recordcount= number of records must first execute move.last...? 

i don't work vary on vbasic , somtimes i'd use acces simple , rapid develop personal database, oftne lokks make lose lot of time... tankyyou help..

recordcount returns number of records accessed far. use movelast method before calling recordcount ensure records loaded before count.

for filter, either set before opening recordset, or reopen recordset after setting filter:

rs.filter = "[idimp] = 125" set rs = db.openrecordset("query42") 

or

rs.filter = "[idimp] = 125" rs.openrecordset 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -