Count records in table

K

KarenM

Hi,

I am trying to count the number of records in a table and display it on a
form. Does anyone have any suggestions? I would really appreciate it.

Thanks,
Karen
 
D

DebbieG

=dcount("*", "YourTableName")

or if the form is based on that table:

me.recordsetclone.recordcount

HTH,
Debbie


| Hi,
|
| I am trying to count the number of records in a table and display it on a
| form. Does anyone have any suggestions? I would really appreciate it.
|
| Thanks,
| Karen
 
F

fredg

Hi,

I am trying to count the number of records in a table and display it on a
form. Does anyone have any suggestions? I would really appreciate it.

Thanks,
Karen

=DCount("*","TableName")
 
K

KarenM

Thank you Debbie & fred. That works for the first record, but when I move to
the next record, I don't get the new count. I am using the arrows at the
bottom of the form for navigation.

Karen
 
D

DebbieG

Where did you put this code? It should be in Form_Current.

Debbie

| Thank you Debbie & fred. That works for the first record, but when I move
to
| the next record, I don't get the new count. I am using the arrows at the
| bottom of the form for navigation.
|
| Karen
|
|
| "fredg" wrote:
|
| > On Fri, 25 Feb 2005 16:35:02 -0800, KarenM wrote:
| >
| > > Hi,
| > >
| > > I am trying to count the number of records in a table and display it
on a
| > > form. Does anyone have any suggestions? I would really appreciate
it.
| > >
| > > Thanks,
| > > Karen
| >
| > =DCount("*","TableName")
| > --
| > Fred
| > Please only reply to this newsgroup.
| > I do not reply to personal email.
| >
 
K

KarenM

I'm sorry, but I guess I'm lost. Here's what I have:

Private Sub Form_Current()
=DCount("*","Quote")
End Sub

I get a syntax error.

Karen
 
J

John Vinson

Thank you Debbie & fred. That works for the first record, but when I move to
the next record, I don't get the new count.

Eh?

If you're just moving from record to record, the count shouldn't
change. If you have 3129 records in the table, it doesn't matter
whether you're looking at the first record or the 3000th record -
there are still 3129 records in the table.

John W. Vinson[MVP]
 
K

KarenM

Yes, that's true, until I get to the last record then click the right arrow.
Doesn't that add a new record?

Karen
 
K

KarenM

I got it to work by putting =DCount("*","TableName") on the form field
Control Source.

Thanks to everyone for their help.
Karen
 
Top