Record Counts

  • Thread starter Thread starter JimS
  • Start date Start date
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....
 
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]
 
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
 
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.
 
=[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
.
 
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)
 
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!
 
Back
Top