Douglas Barnes
doug at starntech.com
Wed May 25 13:40:47 CDT 2005
this should work: SELECT Count(*) AS NumCount FROM tblYouTable Douglas Barnes Starn Technical Services P. O. 1172 Meadville, PA 16335 814.724.1045 doug at starntech.com www.starntech.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Hale, Jim Sent: May 25, 2005 2:16 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Record count 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 Jim Hale *********************************************************************** The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer. As a recipient of this email, you are responsible for screening its contents and the contents of any attachments for the presence of viruses. No liability is accepted for any damages caused by any virus transmitted by this email. *********************************************************************** The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer. As a recipient of this email, you are responsible for screening its contents and the contents of any attachments for the presence of viruses. No liability is accepted for any damages caused by any virus transmitted by this email.