Count records from table (1 Viewer)

Sarre

Registered User.
Local time
Today, 15:02
Joined
May 2, 2007
Messages
14
Hi there,

I'm a newb to access and having a hard time setting up a relation between two tables. I have a blog where members can post their views. User information is stored in one table (Users) and all blog entry is stored in another table (Forum).

How do I count and store "John Smiths" threads in the user table as a number/integer? (have a column named ForumCount)

Been searching the web for hours but the syntax for this operation seems to be going over my head.

Appreciate any help!
 

David Eagar

Registered User.
Local time
Today, 23:02
Joined
Jul 2, 2007
Messages
924
Is there any reason why you need to store the count value? If it can be calculated by a query, you can call up the result as required
 

John Big Booty

AWF VIP
Local time
Today, 23:02
Joined
Aug 29, 2005
Messages
8,262
You can use a Sum (Σ) query to Count the the "John Smiths" in your query results.

However as David Eagar has already pointed out this sort of (calculated data) should on the whole not be stored, you will find a number of discussion on this matter if you search this forum.
 

John Big Booty

AWF VIP
Local time
Today, 23:02
Joined
Aug 29, 2005
Messages
8,262
Essentially the arguments against storing calculated fields are;
  • Why store this information, as it can be calculated any time it needs to be displayed to the user.
  • Unlike Excel, a change to one of the underlying values will not automatically be reflected in the stored value.
  • Ensuring the integrity of your data becomes difficult should should one of the underlying values change, due the the previously mentioned limitation.
 

Sarre

Registered User.
Local time
Today, 15:02
Joined
May 2, 2007
Messages
14
Thanks for the replies! :)

No, you are both right, there is no reason to store the count value.
I just need to bring up the result on a webpage whenever it is asked for.

I did this on a local machine a few years ago, but my harddrive crashed and I lost the whole thing.

Two questions then I'm good to go:

1. I use Dreamweaver, can I place the SUM query in a recordset, and what would it look like?

2. What would be the best placement for the relationship between the two tables?
 

Users who are viewing this thread

Top Bottom