Counting Records on a Form (short)

A

Andy Korth

This should be a short one...
I've got one of those fancy continous forms. In the
header, I'd really like a little text box that says:
"Now viewing 10 records."
Actually, I'd like it to just say 10- when there are 10
rows showing in my form, of course.

Anyway, the obvious solution here is DCount. However, it
doesn't seem to work having DCount in the control source
of a textbox. Any ideas?
The recordsource is a pretty long SQL string, with a
WHERE clause in it, so that needs to be in the DCount, if
that is the route to take.

Thanks a lot,
Andy
 
D

Dirk Goldgar

Andy Korth said:
This should be a short one...
I've got one of those fancy continous forms. In the
header, I'd really like a little text box that says:
"Now viewing 10 records."
Actually, I'd like it to just say 10- when there are 10
rows showing in my form, of course.

Anyway, the obvious solution here is DCount. However, it
doesn't seem to work having DCount in the control source
of a textbox. Any ideas?
The recordsource is a pretty long SQL string, with a
WHERE clause in it, so that needs to be in the DCount, if
that is the route to take.

You *could* use DCount, if you set it up properly, but it's probably
simpler to use this as the controlsource for your text box:

=Count(*)
 
A

Andy Korth

Ha, perfect! Thanks a lot.
Count... works even better than DCount. Wonder how I
missed that one.

:D
Andy
 

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

Top