[AccessD] How to - get a count for a condition

William Hindman wdhindman at bellsouth.net
Thu May 13 09:40:43 CDT 2004


...off the top and not tested

    Dim rs1 As Recordset
    Set rs1 = CurrentDb.OpenRecordset("SELECT * FROM <<TableName>> WHERE_
datLoginDate Between #<<BegDate>># and #<<EndDate>>#;", dbOpenDynaset,
dbReadOnly)
    With rs1
        .MoveLast
        Me!txtCount = .RecordCount
    End With


William Hindman
"The world's becoming a museum of socialist failures." John Dos Passos


----- Original Message ----- 
From: "John Clark" <John.Clark at niagaracounty.com>
To: <accessd at databaseadvisors.com>
Sent: Thursday, May 13, 2004 10:11 AM
Subject: [AccessD] How to - get a count for a condition


> I thought this would be simpler, but...I need to get a count for records
> logged in a given time period, and I seem to be at a loss. Basically, I
> have a field called 'datLoginDate' and I want to find all records
> 'logged' during a period, which I will get from a 'BegDate' and an
> 'EndDate' on the form.
>
> I first thought they wanted a list of the records, so I have a query
> already that finds these records. And, I know from running the query,
> how many records exist. But, how do I just get the number?
>
> This program is A97, but I am moving it over to A2K soon, so a solution
> for both would be great.
>
> Thanks!
>
> John W Clark
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>





More information about the AccessD mailing list