Simple Counting Question

T

Trial & Error

Its early... brain isnt working, and I cannot for the life of me get this to
work

I would like a running total to appear on my switchboard.

I have a table in my DB, within it, there is 1 field that I would like to
have counted, and displayed on my switchboard.

I do not want it to be anything more than simply a number, just the total
number of entries that have been made so far, in that field within that table.

What is entered in the field dosnt matter... as long as it isnt Null.. I
would like it to be counted.

Thanks !!!!
 
D

Dirk Goldgar

Trial & Error said:
Its early... brain isnt working, and I cannot for the life of me get
this to work

I would like a running total to appear on my switchboard.

I have a table in my DB, within it, there is 1 field that I would
like to have counted, and displayed on my switchboard.

I do not want it to be anything more than simply a number, just the
total number of entries that have been made so far, in that field
within that table.

What is entered in the field dosnt matter... as long as it isnt
Null.. I would like it to be counted.

Thanks !!!!

You can put a calculated text box on the form with a controlsource that
uses the DCount function to count the non-null occurrences of that field
in that table. It would look like this:

=DCount("YourFieldName", "YourTableName")

However, while that form remains open, the text box won't automatically
be updated every time you add, delete, or update records in the table.
To keep it up to date (unless you close and reopen the switchboard
form), you have to requery the text box or recalculate the form either
periodically (triggered perhaps by a Timer event on the form) or by the
events that fire whenever records are added, modified, or deleted in the
table. That would mean adding a little code to the form (or forms) that
updates the table.
 
R

Rick Brandt

Trial said:
Its early... brain isnt working, and I cannot for the life of me get
this to work

I would like a running total to appear on my switchboard.

I have a table in my DB, within it, there is 1 field that I would
like to have counted, and displayed on my switchboard.

I do not want it to be anything more than simply a number, just the
total number of entries that have been made so far, in that field
within that table.

What is entered in the field dosnt matter... as long as it isnt
Null.. I would like it to be counted.

Thanks !!!!

=DCount("FieldName", "TableName")

I'm pretty sure that this will NOT count rows where the value is Null. If
you find that it does then you can change to...

=DCount("FieldName", "TableName", "FieldName Is Not Null")
 
T

Trial & Error

Hey Guys,

Apreciate the help...
never the less, both suggestions retrun an error.

The comand looks great in design view, but when I run the form, #Error
appears in the text box.

Access dosnt give me any details as to what error... just #error.

????????????????
 
R

Rick Brandt

Trial said:
Hey Guys,

Apreciate the help...
never the less, both suggestions retrun an error.

The comand looks great in design view, but when I run the form, #Error
appears in the text box.

Access dosnt give me any details as to what error... just #error.

????????????????

Post your expression. This would normally mean you mispelled the field name
or table name.
 
D

Dirk Goldgar

Trial & Error said:
Hey Guys,

Apreciate the help...
never the less, both suggestions retrun an error.

The comand looks great in design view, but when I run the form, #Error
appears in the text box.

Access dosnt give me any details as to what error... just #error.

????????????????

What is the name of the text box, and what did you put in its
controlsource? This switchboard form isn't bound, is it?
 
T

Trial & Error

The Table is called "LessonBooker"

The field I wish to count and display is "USER TAG"

I created a text box on the switchboard and titled it "Entries to Date"

In its Control Source I clicked "..." and entered:

=DCount("User Tag","LessonBooker")

I also tried

=Count ...
 
D

Dirk Goldgar

Trial & Error said:
The Table is called "LessonBooker"

The field I wish to count and display is "USER TAG"

I created a text box on the switchboard and titled it "Entries to
Date"

In its Control Source I clicked "..." and entered:

=DCount("User Tag","LessonBooker")

Since your field name contains a space -- not a good idea, for this very
reason -- you have to wrap it in square brackets:

=DCount("[User Tag]","LessonBooker")
I also tried

=Count ...

No, that wouldn't work unless your form were bound to the table.
 
Top