Results 1 to 3 of 3
  1. #1
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

    Problem With Report

    I have 2 Combo boxes
    CboD2p = Customer Title is Selected to whome goods are delivered
    Cbopp = Goods Purchased from
    The Following Code is Used

    Private Sub CboD2p_AfterUpdate()
    Dim strSource As String
    strSource = "SELECT DISTINCT [PurCompanyName] " & _
    "FROM Purchases " & _
    "WHERE [Delivered To Party] = '" & Me.CboD2p & "' ORDER BY [PurCompanyName]"
    Me.CboPP.RowSource = strSource
    Me.CboPP = vbNullString

    End Sub



    FOR The Report following Code Is Used



    Private Sub Command29_Click()
    On Error GoTo Err_Handler

    Const REPORTNAME = "General Purchase wo Varification"
    Const MESSAGETEXT = "No Item Selected."
    Dim strCriteria As String

    ' build string expression to filter report
    ' to selected customer
    strCriteria = "[Delivered To Party] = """ & Me.CboD2p & """"


    ' make sure a customer is selected
    If Not IsNull(Me.CboD2p) Then
    ' open report filtered to selected customer
    DoCmd.OpenReport REPORTNAME, _
    View:=acViewPreview, _


    WhereCondition:=strCriteria
    Else
    MsgBox MESSAGETEXT, vbExclamation, "Invalid operation"
    End If

    Exit_Here:
    Exit Sub

    Err_Handler:
    MsgBox Err.Description, vbExclamation, "Error"
    Resume Exit_Here
    End Sub



    When I open the report instead of it showing me only the PurCompanyName I selected. It shows all PurCompanyName wherever Delivered To Party is


    example: it shows me Delivered To Party (This Is Customer) has bought abc goods from Pepsi Company and also from Coke. Which it should only show if its bought from pepsi as only pepsi is selected and not coke because coke was not selected.

    Whereas on Combo Box it separates pepsi & coke but on report it shows both of them.
    Last edited by aamer; 10-11-2014 at 02:44 PM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    The filter criteria is based on [Delivered To Party]. There is no filtering for [PurCompanyName]. There is no parameter for "=Pepsi".

    Doesn't matter what is selected in comboboxes if there is no filter parameter in the report WhereCondition argument that uses the selections.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Thx June7 for guiding me in the right direction.
    The following link was helpful to solve the problem.

    http://datapigtechnologies.com/flash...mtoreport.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Problem Regarding Report
    By glen in forum Reports
    Replies: 18
    Last Post: 08-21-2012, 02:21 AM
  2. help with a report problem
    By imintrouble in forum Access
    Replies: 2
    Last Post: 02-23-2012, 02:45 PM
  3. report problem
    By mann2x in forum Reports
    Replies: 1
    Last Post: 10-09-2010, 06:10 PM
  4. Problem with sub-report
    By samo1215 in forum Reports
    Replies: 0
    Last Post: 06-27-2010, 01:11 PM
  5. Report Problem
    By tlitman09 in forum Reports
    Replies: 0
    Last Post: 02-20-2007, 09:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums