AccessAmateur
Registered User.
- Local time
- Today, 06:53
- Joined
- Feb 13, 2003
- Messages
- 30
Example:I have a table with 3 fields: Name,Book,NumBooks
Each Name can have more than one book. I want to count the number of books each name has and put it in the NumBooks field.
ie: Update 'NumBooks' to equal count 'Book' for 'Name' = 'Name'. Setting up a Query Update Name to Count(Book) criteria Name = Name gives the very odd error "You tried to execute a query that doesn't include the specified expression NumBooks in an aggregate function". I also tried it using two tables figuring that Name=Name maybe wouldn't work but same result.
Using the Dcount function
Dcount([TableName!Book],"TableName",Name=Name]
the query runs but then wont' update: 'xxx records not updated due to a type conversion error'. Dcount is supposed to be a integer result & NumBooks is LongInteger.
The count function will work in a report: group on Name then count books but how do I get then result back into tha table?
Each Name can have more than one book. I want to count the number of books each name has and put it in the NumBooks field.
ie: Update 'NumBooks' to equal count 'Book' for 'Name' = 'Name'. Setting up a Query Update Name to Count(Book) criteria Name = Name gives the very odd error "You tried to execute a query that doesn't include the specified expression NumBooks in an aggregate function". I also tried it using two tables figuring that Name=Name maybe wouldn't work but same result.
Using the Dcount function
Dcount([TableName!Book],"TableName",Name=Name]
the query runs but then wont' update: 'xxx records not updated due to a type conversion error'. Dcount is supposed to be a integer result & NumBooks is LongInteger.
The count function will work in a report: group on Name then count books but how do I get then result back into tha table?