count of records

KLerma

New member
Local time
Today, 00:43
Joined
Aug 28, 2001
Messages
5
All,

I am looking to get a count of a record set and dump it into a variable.

I attempted to do the following:

docmd.runsql ("select count(*) from Schedule where pdate is between" & variable1 & " and" & variable2.

I learned from another post that runsql requires action.

HOW DO I DO THIS??

Thanks in advance
 
You could open the query def using DAO or ADO as a recordset and do a recordcount. A simpler way would be to use the Dcount function.
 
K,

See Access Help or use the Search Facility here for DCount.

Code:
Me.MyCount = Nz(DCount("[pdate]", "Schedule", "[pdate] Between #" & Me.variable1 & "# and #" & Me.variable2 & "#"), 0)

Wayne
 
That was the ticket!!!

Again, this forum rules and u guys rule

Kevin
 

Users who are viewing this thread

Back
Top Bottom