Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

another count question

Status
Not open for further replies.

coyote69

Technical User
Feb 19, 2002
45
US
need to count number of sale base on a date the user inputs

Private Sub datesrch()
Dim searchfor As String
Dim db As Database
Dim rs As Recordset

Dim sqlstring As String

Set db = OpenDatabase("c:\data\op\pos405\contact2\contactmanager.mdb")

searchfor = InputBox("enter new sales date")


Id is a field, salesdate is another field and contactmanager is the table name

sqlstring = "Select id, and count(contactmanager.Id) AS Noofsales FROM ContactManager and GROUP by contactmanager.Id having (((contactmanager.salesdate) = #" & searchfor & "#"

Set rs = db.OpenRecordset(sqlstring)

picResults.Print rs.Fields(" noOfsales ")

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top