My Assistant
![]() ![]() |
|
|
Aug 8 2007, 03:54 PM
Post
#1
|
|
|
New Member Posts: 11 |
In Access, is it possible to write a query that sums up a column, but skips over rows that are not numeric so that it does not return a datatype mismatch error?
Thank you. |
|
|
|
Aug 8 2007, 04:22 PM
Post
#2
|
|
|
Access Wiki and Forums Moderator Posts: 48,113 From: SoCal, USA |
You will need to create a query that eliminates those records first before doing the Totals query. HTH.
|
|
|
|
Aug 8 2007, 05:48 PM
Post
#3
|
|
|
UtterAccess VIP Posts: 1,283 From: AZ |
theDBguy is right and this is one way you might do that...
select sum(field) from table where isnumeric(field) = true |
|
|
|
Aug 9 2007, 08:53 AM
Post
#4
|
|
|
UtterAccess VIP Posts: 5,635 From: Chicagoland, USA |
Or you can use iif() to skip over just the values in that field without eliminating that record entirely if different fields will have null in different records. Like below:
select sum(iif(isnumeric(field), field,0)) as sumoffield, sum(iif(isnumeric(field1), field1,0)) as sumoffield1 from table |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 06:22 AM |