Q. How do I total the number of fields in a table ?

  • Thread starter Thread starter Jim Jones
  • Start date Start date
J

Jim Jones

Hi.

I'm trying to fotal the number of fields in a table.

That table has a primary key.

Apparently there doesnt seem to be a difference on how many fields I
use. No matter what, I always get an extra field with all "1"s.

I think if I could total all those ones, I'd get the answer I need to
plug into a form field, but I can't make it work beyon that.

I'm using Access 2000.

Please help,
Thanks,
Jim
 
Jim

Your statement could be taken more than one way. "... total the number of
fields in a table" could mean to count how many fields there are in a table.
In daily relational database use, this would rarely be needed.

The statement might mean to total (i.e., sum) the values in all the fields
of a table. This is possible to do, but strongly implies that the table is
not normalized sufficiently (i.e., in a normalized table design, you would
be summing the values in a single field, not across all fields).

You mention getting "an extra field with all 1's" -- I don't understand
"where" this is happening.

If you post the SQL statement of your query, the 'group readers could offer
further approaches...
 
Jim

Your statement could be taken more than one way. "... total the number of
fields in a table" could mean to count how many fields there are in a table.
In daily relational database use, this would rarely be needed.

The statement might mean to total (i.e., sum) the values in all the fields
of a table. This is possible to do, but strongly implies that the table is
not normalized sufficiently (i.e., in a normalized table design, you would
be summing the values in a single field, not across all fields).

You mention getting "an extra field with all 1's" -- I don't understand
"where" this is happening.

If you post the SQL statement of your query, the 'group readers could offer
further approaches...

Ok, I have a query, with 2 tables.
the one table is all the different cars owned by all the different
customers. The other table is all the different customers.
I've included both so I can have customer first name, last name, and
car year, make, model.

How do I set the query to count all the car records (the total number
of cars) ?

thanks,
Jim
 
Jim

You'd need to have the CustomerID as a foreign key in the Vehicles table.
You'd need to join the Customer table to the Vehicles by that key. You'd
need to select the customer name/info, plus the vehicle ID (or
Make/Model/Year, or whatever you're using to show separate vehicles).

If you did all these in a query, you'd get every Customer with at least one
Vehicle, and a row for every Customer/Vehicle combination.

If you want to do a count, you could write a second query that uses the
"Totals" features (see the Toolbar button that is a Greek Sigma...), and
groups by CustomerID, counting the VehicleIDs.
 
Back
Top