open a report by the month

M

Michael

I have a report with the SQL below. I have a from with the numbers 1 - 12 in
a list box with a submit button that goes to the report
"totalpedanabyfornmonth" as you can see in the sql I use Format([del],"mm")
AS [Month] to break down the date to get the month only.
I forget how to pass the month from the dropdown list to the report.

sorry if a really dumb question.

thanks for your help
Michael





Report--------------------


SELECT Count([Registro Entrate].NPedanaID) AS CountOfNPedanaID1, [Registro
Entrate].Prodotto, [Registro Entrate].Fornitore, Format([del],"mm") AS
[Month]
FROM [Registro Entrate]
GROUP BY [Registro Entrate].Prodotto, [Registro Entrate].Fornitore,
Format([del],"mm");




Form------------------------------------------------


Option Compare Database

Private Sub List0_AfterUpdate()

End Sub
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

Dim stDocName As String

stDocName = "totalpedanabyfornmonth"
DoCmd.OpenReport stDocName, acPreview

Exit_Command2_Click:
Exit Sub

Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click

End Sub
 
J

Jeff Boyce

Michael

Your SQL statement needs the addition of a WHERE clause, something like:

WHERE Format([del],"mm") = Forms!YourFormName!YourListboxName

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
 

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