openrecordset

  • Thread starter meckmoralde via AccessMonster.com
  • Start date
M

meckmoralde via AccessMonster.com

Guys Please Help Me , i dont know what is wrong with my code

Private Sub Command3_Click()

Dim dbs As Database
Dim rstSchedule As Recordset
Dim strSQL As String


Set dbs = CurrentDb()

strSQL = "SELECT SaleSubDate,SaleSubStoreCde, SalesSubStyleNo,Sum
(SaleSubQty) AS SumOfSaleSubQty FROM SalesFromYolly GROUP BY SaleSubDate,
SaleSubStoreCde, SalesSubStyleNo HAVING (((SaleSubDate Between #7/27/2009#
And #7/31/2009#) AND (SaleSubStoreCde= 0011) AND ((SalesSubStyleNo)
=205112061008));"

Set rstSchedule = dbs.OpenRecordset(strSQL, dbOpenDynaset)

MsgBox rstSchedule![SumOfSaleSubQty]
 
A

Allen Browne

Do you get any error message?

Does your code compile? (Compile on Debug menu, in the code window)

Are any records returned?
 
D

Douglas J. Steele

Are you getting an error message along the lines of "one parameter
expected"?

Change the line to

Dim rstSchedule As DAO.Recordset

If that's not the issue, then answer Allen's questions.
 

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