Results 1 to 4 of 4
  1. #1
    mattzkn is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    3

    Macro to apply filter to form

    Hi All,



    I have no idea what i am doing with macro's, but i am fairly sure what i am trying to achieve is simple. I want a macro to apply two filters to a form "contact list"

    First filter should only show records if field in column "hotlist?" is blank

    Second filter should only show records if field in column "interested?" is blank or "Yes"

    I will attach this macro to a button so when i click it, the form is only displaying results where there is no data entered in 'hotlist' AND there is either no data in 'interested' or the data entered says 'Yes'

    How would i go about doing this?

    Thanks alot!

    Matt

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,891
    Is this form already open or do you want to open it with the filter applied? I don't use macros, only VBA, but I am sure either is possible with macro.

    Are both fields text type?
    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
    mattzkn is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    3
    Hi, thanks for your response.

    The form will already be open, both fields are text.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,891
    One approach is to set the Filter and FilterOn properties of the form. In VBA I would:

    Me.Filter = "hotlist Is Null And (interested='Yes' Or interested Is Null)
    Me.FilterOn = True

    I don't know what the macro structure would be.
    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. Filter By Form and Apply Filter Buttons
    By JustLearning in forum Forms
    Replies: 13
    Last Post: 02-18-2015, 01:01 PM
  2. Replies: 4
    Last Post: 10-16-2013, 07:07 AM
  3. Replies: 1
    Last Post: 04-28-2013, 09:43 PM
  4. Replies: 2
    Last Post: 02-25-2013, 10:47 AM
  5. Replies: 5
    Last Post: 02-07-2013, 12:21 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