Record Counts

J

JimS

I built a simple form using the wizard (it's easier...) Its record source is
a table (tblBoM). I use a combo box in the header to filter the form. I need
to display in a combo box the number of records in the form. Me.Count is
giving me some number which may or may not be the UnFiltered record count,
but in any case, it's wrong.

What can I use? I've bludgeoned it to death with a dCount() reference as the
control source of the text box, but I just can't imagine that's the best way
to go....
 
F

fredg

I built a simple form using the wizard (it's easier...) Its record source is
a table (tblBoM). I use a combo box in the header to filter the form. I need
to display in a combo box the number of records in the form. Me.Count is
giving me some number which may or may not be the UnFiltered record count,
but in any case, it's wrong.

What can I use? I've bludgeoned it to death with a dCount() reference as the
control source of the text box, but I just can't imagine that's the best way
to go....

=[RecordsetClone].[RecordCount]
 
M

Marshall Barton

JimS said:
I built a simple form using the wizard (it's easier...) Its record source is
a table (tblBoM). I use a combo box in the header to filter the form. I need
to display in a combo box the number of records in the form. Me.Count is
giving me some number which may or may not be the UnFiltered record count,
but in any case, it's wrong.

What can I use? I've bludgeoned it to death with a dCount() reference as the
control source of the text box, but I just can't imagine that's the best way
to go....


Me.Count is the number of controls on the form so that's not
relevant to your problem.

Use some code in the combo box to set the record count in a
text box:

With Me.RecordsetClone
.MoveLast
Me.thetextbox = .RecordCount
End With
 
D

Daryl S

Jim -

Put this in a textbox in your form header or footer:
=Count([primarykeyfield])
but using your primary key field name. The count also appears in the
record navigation bar if that is displayed on your form.
 
J

JimS

=[RecordsetClone].[RecordCount] gets me a #Name? error.

btw...A2007
--
Jim


fredg said:
I built a simple form using the wizard (it's easier...) Its record source is
a table (tblBoM). I use a combo box in the header to filter the form. I need
to display in a combo box the number of records in the form. Me.Count is
giving me some number which may or may not be the UnFiltered record count,
but in any case, it's wrong.

What can I use? I've bludgeoned it to death with a dCount() reference as the
control source of the text box, but I just can't imagine that's the best way
to go....

=[RecordsetClone].[RecordCount]
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
.
 
S

Stuart McCall

John W. Vinson said:
=[RecordsetClone].[RecordCount] gets me a #Name? error.

btw...A2007

Try

Me.RecordsetClone.RecordCount

You can't use the Me keyword in a property expression. You must use [Form]
instead (if you type Form, Access will surround it with square brackets)
 
J

John W. Vinson

John W. Vinson said:
=[RecordsetClone].[RecordCount] gets me a #Name? error.

btw...A2007

Try

Me.RecordsetClone.RecordCount

You can't use the Me keyword in a property expression. You must use [Form]
instead (if you type Form, Access will surround it with square brackets)

thanks Stuart, you're right of course!
 

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