Multiple criteria

R

Ramone

I was looking for help with the following code.
I would like to count the agents hired after 2002 and
were hired directly

Dim hiretype As Text
Dim agntct As Integer
Dim dbs As Database, rst As Recordset
hiretype = "Direct"
agntct = DCount("[Agent Hire
Date]", "tblAgentdetail", "[Hire Type]= '" & hiretype
& "' and [Hire Date]> #12/31/2002# ")
' Return reference to current database.D
Set dbs = CurrentDb
' Open table-type Recordset object.
Set rst = dbs.OpenRecordset("TestAG")
rst.AddNew

rst.Fields("Year 1").Value = agntct
rst.Update
rst.Close
Set dbs = Nothing

End Sub


Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top