[AccessD] Record count

Gustav Brock Gustav at cactus.dk
Wed May 25 14:11:30 CDT 2005


Hi Jim

- or better:

booTableNotEmpty = Not IsNull(DLookup("ID", "tblNewTransCodes"))

/gustav

>>> Gustav at cactus.dk 05/25 8:32 pm >>>
Hi Jim

Holy Moly ... how about a one-liner:

booTableNotEmpty = CBool(DCount("*", "tblNewTransCodes"))

/gustav


>>> Jim.Hale at FleetPride.com 05/25 8:15 pm >>>
Thanks everyone. Here is what I use when I need to determine the
NUMBER
of
records, it just seems like a lot of code to see if there are ANY
records.

Dim dbs As Database, rs(1) As Recordset, strQry(1) As String, intCt As
Integer

Set dbs = CurrentDb
strQry(1) = "SELECT Count(tblNewTransCodes.fldDesc) AS CountOffldDesc
FROM
tblNewTransCodes;"
 Set rs(1) = dbs.OpenRecordset(strQry(1))
        intCt = rs(1).Fields("countoffldDesc")
 If Not (rs(1) Is Nothing) Then rs(1).Close: Set rs(1) = Nothing   
If Not (dbs Is Nothing) Then dbs.Close: Set dbs = Nothing

Jim Hale

-----Original Message-----
From: Hale, Jim [mailto:Jim.Hale at fleetpride.com] 
Sent: Wednesday, May 25, 2005 12:19 PM
To: 'Accessd (E-mail)
Subject: [AccessD] Record count


What is the easiest way in code to determine if a table has at least
one
record? TIA




More information about the AccessD mailing list