Results 1 to 3 of 3
  1. #1
    EGTax is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    4

    only show results in report

    Hello all,



    I wrote a pretty simple inventory database for my office, which does what i need except the report, i have a couple filters that i use to show only parts of the report, but i need to figure out how to make the report only show what i filter out..

    Click image for larger version. 

Name:	snip1.PNG 
Views:	17 
Size:	63.6 KB 
ID:	30535

    the 2 filters are office number and category, so when i use them like so:

    Click image for larger version. 

Name:	Snip2.PNG 
Views:	17 
Size:	36.8 KB 
ID:	30536

    but when i click on report, it only has every record in the report.

    For the report i ran the report wizard and then changed the design a bit, so i am sure i have to set some parameters somewhere, but im not sure how.


    any help on this is appreciated.

    Thank you,

    Bob

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    build the 'where' clause, then show report:

    Code:
    '----------------
    sub btnReport_click()
    '----------------
    dim sWhere as string 
    
    
    sWhere = "1=1"
    if not IsNUll(cboCat) then sWhere = sWhere & " and [Catagory]='" & cboCat & "'"
    if not IsNUll(cboOffNum) then sWhere = sWhere & " and [officenum]='" & cboOffNum & "'"
    
    
    If sWhere = "1=1" Then
      docmd.OPenReport "rMyReport",acViewPreview
    Else
      docmd.OPenReport "rMyReport",acViewPreview,,sWhere
    End If
    end sub

  3. #3
    EGTax is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    4
    Thank you, This was exactly what I was looking to accomplish!
    Much appreciated!

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

Similar Threads

  1. Replies: 1
    Last Post: 07-03-2017, 01:14 PM
  2. Replies: 5
    Last Post: 08-31-2015, 01:03 PM
  3. only show this years results
    By sdel_nevo in forum Queries
    Replies: 4
    Last Post: 12-16-2014, 06:39 AM
  4. IIf statement to show all results
    By nigelbloomy in forum Queries
    Replies: 5
    Last Post: 07-22-2013, 02:00 PM
  5. Replies: 6
    Last Post: 05-14-2012, 07:24 AM

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