At a glance I can see that you need an error handler for this line of
code when you have an empty table.
dtaTotalCards.Recordset.MoveFirst
An ON ERROR RESUME NEXT would do.
if err then
err=0
end if
I wouldn't worry about counting the number of records in the table. The
error statement would do this.
If you really need a count then you could do this with the following
statement:
SELECT table.field1, count(table.field1) AS aliasfield
FROM table
WHERE table.field2=value
GROUP BY table.field1
--
Alexander Medwedew
Computer Ventures, Inc.
http://tribeca.ios.com/~compvent/
CADVANCE LITE - Affordable CAD Software
http://tribeca.ios.com/~compvent/cadvlite.html