Spurrious RecordCount values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a frmSearch that gives the user the opportunity to search my db for
various fields. Thier choices build a SQL string that is used to open the
frmResults form with the search results. On the frm Results form I also
wanted to display a txtResults textbox field that displays the total number
of records found that matched their search criteria, using
"Recordset.RecordCount". The frmResults form is designed to display 3 records
at a time (an arbitary value to make the from look aesthetic). When the
search result has 3 or less solutions, txtResults correctly displays the
"Recordset.RecordCount" value. However, if the resulting search produces more
than 3 soltuons the txtResult textbox still only displays "3" as it's value
even though there are more. Interestingly, if I expand the frmResults from to
display 4 solutions the txtbox, txtResults displays the value "4". It's as if
the value of Recordset.RecordCount matches the number of records displayable
only....EXCEPT if I move into Design mode and then back to View mode the
txtResults displays the value of all the records in the db.

Am I using "Recordset.RecordCount" correctly or is there something else I
need to consider.

Thanks,
Ian.
 
RecordCount is seldom correct unless you've moved to the end of the
recordset first.

You either need to do a MoveLast before you refer to RecordCount (which can
have performance implications...), or get the record count some other way.
 
Thanks Douglas,

At least I know there's nothing fundamentally wrong that I'm doing!!

I put a .MoveLast into the code and it appears to have cured the problem. I
take your point about performance implications and I'll keep a close eye on
things, but I don't anticpate the recordset to be too big, certainly no more
than 20-30 records at present.

Thanks again for your help,
Ian.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top