Results 1 to 6 of 6
  1. #1
    Boost is offline Advanced Beginner
    Windows 8 Access 2013 64bit
    Join Date
    May 2018
    Posts
    47

    Reporting to only include indicated data criteria from a Query Filter

    Hi there, with the assistance of many forum members I have implemented an advance search form into my db.



    The advance search form was provided by Gicu - whose assistive thread can be located https://www.accessforums.net/showthread.php?t=72947 here.

    The advance search form allows the user to select a particular query, then apply filters (<, >, <=,=, LIKE) etc. to narrow down the search results.

    From here, ideally I want to try and construct a report that only utilises the selected criteria from the Advanced Search Form. I would also like to accomplish this task via VBA code held within a button on the form.

    This is due to end-user requirements and/for people who won't understand the report wizard etc.

    Any help would be largely appreciated.

    Kind Regards

    Boost

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Save the constructed criteria somewhere (textbox, variable, TempVar). Use it in WHERE argument of OpenReport command.
    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
    Boost is offline Advanced Beginner
    Windows 8 Access 2013 64bit
    Join Date
    May 2018
    Posts
    47
    Cool thanks for the response - I've started to look into what you recommended and have managed to link the text-box that contains the particular filter.

    The text-box that contains the filter is called
    Code:
    txtFilter
    , and its value changes depending on the user-inputted query.

    How should my WHERE CONDITION look in my macro?

    I constructed this so far (screenshot 2) but all that occurs is a pop-up that I have to re-enter the filter.

    Any help would be appreciated!

    Cheers

    Boost

    Click image for larger version. 

Name:	Capture.JPG 
Views:	14 
Size:	25.8 KB 
ID:	34830Click image for larger version. 

Name:	Screenshot2.JPG 
Views:	14 
Size:	27.7 KB 
ID:	34831Click image for larger version. 

Name:	Screenshot3.JPG 
Views:	13 
Size:	16.4 KB 
ID:	34832

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I don't use macros, only VBA.

    I think macro will require path like: Forms!formname![txtFilter]
    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.

  5. #5
    Boost is offline Advanced Beginner
    Windows 8 Access 2013 64bit
    Join Date
    May 2018
    Posts
    47
    What then should/could my VBA code look like? I'm more inclined to utilise VBA too...

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    DoCmd.OpenReport "rpt_Advance_Reporting", acViewPreview, , Me.txtFilter
    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.

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

Similar Threads

  1. Replies: 1
    Last Post: 11-18-2016, 08:41 AM
  2. Replies: 1
    Last Post: 10-13-2015, 05:28 PM
  3. Replies: 11
    Last Post: 11-11-2014, 08:59 AM
  4. Replies: 6
    Last Post: 09-23-2013, 03:17 PM
  5. Query: How To Filter Data In Criteria
    By netchie in forum Queries
    Replies: 1
    Last Post: 08-31-2011, 01:36 PM

Tags for this Thread

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