ADDING a combox to the sales Report Dialog box from Northwind.DB

nakamichie

Registered User.
Local time
Today, 13:58
Joined
Apr 8, 2015
Messages
16
Hello I have figured out how to use the Northwind Data base's SALES REPORT DIALOG form to print cross tab reports. Everything is working fine but now I would like to know if there is some way to add another combobox to filter down the information by Organization or just have all peoples record show. The code I am currently using is this:

******** PLEASE ADD CODE TAGS
Code:
Sub PrintReports(ReportView As AcView)
    ' This procedure used in Preview_Click and Print_Click Sub procedures.
    ' Preview or print report selected in the ReportToPrint option group.
    ' Then close the Print T_ReportsMLOTally Dialog form.
    Dim strReportName As String
    Dim strReportFilter As String
    Dim lOrderCount As Long

    ' Determine report filtering
    If Nz(Me.lstReportFilter) <> "" Then
        strReportFilter = "([SalesGroupingField] = """ & Me.lstReportFilter & """)"
    End If
    
    ' Determine reporting time frame
    Select Case Me.lstSalesPeriod
    Case ByYear
        strReportName = "Yearly Sales Report"
        lOrderCount = DCountWrapper("*", "MLO Analysis", "[Year]=" & Me.cbYear)
    Case ByQuarter
        strReportName = "Quarterly Sales Report"
        lOrderCount = DCountWrapper("*", "MLO Analysis", "[Year]=" & Me.cbYear & " AND [Quarter]=" & Me.cbQuarter)
    Case ByMonth
        strReportName = "Monthly Sales Report"
        lOrderCount = DCountWrapper("*", "MLO Analysis", "[Year]=" & Me.cbYear & " AND [Month]=" & Me.cbMonth)
    End Select
        
    If lOrderCount > 0 Then
        TempVars.Add "Group By", Me.lstSalesReports.Value
        TempVars.Add "Display", DLookupStringWrapper("[Display]", "T_ReportsMLOTally", "[Group By]='" & Nz(Me.lstSalesReports) & "'")
        TempVars.Add "Year", Me.cbYear.Value
        TempVars.Add "Quarter", Me.cbQuarter.Value
        TempVars.Add "Month", Me.cbMonth.Value
        
        DoCmd.OpenReport strReportName, ReportView, , strReportFilter, acDialog
        
    Else
        MsgBoxOKOnly NoSalesInPeriod
    End If
End Sub
****************



I want to add a Combobox called CboOrgList so that I can pick a Yearly Sales Report or Monthly or Quarterly by the Year/month, etc but have the ability to also filter it by organization or just have all. I just can't figure out how to do this with the above code and if I need to change something in the Sales Report Reports too and if so what. This is the last thing I need to figure out and can complete this assigned project I have been given. I have searched the Internet for ideas on this but none seem to work or I don't know where to add the field with the above code.

I am still new here so this is all new and exciting to me.

Any help would be great - Thanks.
 
Last edited by a moderator:

Users who are viewing this thread

Back
Top Bottom