Results 1 to 3 of 3
  1. #1
    Michael.Reynolds1775 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    22

    Clean up report with a filter

    hello all,

    I'd like to clean up my reports a bit. I think if I apply a filter, it would do wonders, but I'm not quite sure how. I've created a switchboard, that runs reports for me, but I only want to display personnel with certain qualifications. Below is the current report that I've made of fork lift drivers. I do not want to display those employees that do not have licenses. How can I do this?

    thanks in advance,
    Mike



    Click image for larger version. 

Name:	fork report.jpg 
Views:	11 
Size:	193.9 KB 
ID:	20210

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    What is the recordsource of the report you are showing?

    You could add a filter. It would be helpful to readers if you posted a jpg of your tables and relationships (relationships window).

    Here's a link to Martin Green's Dynamic Reports that may have info for you.

    Good luck with your project.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Build the filter in the form that opens the report.
    use combos or lists, then see what the user picked...and these will be the filter for the rpt qry.

    You cant use form boxes in a query if there's nothing in them..so..
    Test all controls for a possible filter then build the sql.
    on btnRpt_Click()...

    Code:
    dim sSql as string, sWhere as string
    
    if not isnull(cboState) then   sWhere = sWhere & " and [state]='" & cboState & "'"
    if not IsNull(txtName) then    sWhere = sWhere & " and [Name]='" & txtName & "'"
    if not IsNull(chkContact) then sWhere = sWhere & " and [Contact]=" & chkContact.value
    
        'remove 1st And
    sWhere= mid(sWhere,4)
    
    sSql = "SELECT * FROM tblCompany WHERE " & sWhere
    
    OpenRptFilter(pvRpt, pvQry)
    end sub
    
    
    PUBLIC SUB  OpenRptFilter(pvRpt, pvQry)
    dim rpt
    
    DoCmd.OpenReport pvRpt, acViewDesign
       Set rpt = Reports(pvRpt)
        rpt.recordsource = pvQry
    
       'rpt.OrderByOn = True
       'rpt.OrderBy = sFld
    DoCmd.Close acReport, rpt.Name, acSaveYes
    
    DoCmd.OpenReport vRpt, acViewPreview
    end sub

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

Similar Threads

  1. Data Clean Up.
    By leungyen in forum Queries
    Replies: 14
    Last Post: 01-12-2015, 01:49 PM
  2. Clean Phone Number data
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 03-11-2013, 10:24 AM
  3. VBA Code Clean up?
    By need_help12 in forum Access
    Replies: 1
    Last Post: 04-20-2012, 03:00 PM
  4. Creating a Clean User Application
    By sesproul in forum Forms
    Replies: 1
    Last Post: 03-05-2010, 06:32 PM
  5. Data clean
    By derf in forum Programming
    Replies: 0
    Last Post: 09-20-2008, 09:37 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