Results 1 to 6 of 6
  1. #1
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    209

    Filter Form On Load


    How can I filter a form so that when it loads, by default it only shows records where a field (called currentStatus) Is Null or InActive

    Further info if needed, this form is based off a table called employeeInfo and the form is called employeeDetails

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    When you open the form, set a Where condition:
    DoCmd.OpenForm formname,,,"CurrentStatus=Null Or CurrentStatus='InActive'"

  3. #3
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    209
    Where would this go? Is this in the VBA for the OnOpen() event?

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    No, it is when you open the form - where is it being opened from?

  5. #5
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    209
    From a command button on a seperate form. I use this to open it
    Code:
        Dim stDocName As String
        Dim stLinkCriteria As String
    
    
        stDocName = "employeeDetails"
        DoCmd.OpenForm stDocName, , , stLinkCriteria

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Add the code I used above with: stLinkCriteria="CurrentStatus.... That is your Where condition.

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

Similar Threads

  1. Filter form on load
    By hithere in forum Programming
    Replies: 1
    Last Post: 07-11-2014, 10:53 AM
  2. Getting Form to Filter Records On Load
    By Dclassen89 in forum Forms
    Replies: 12
    Last Post: 02-01-2014, 07:39 PM
  3. Replies: 8
    Last Post: 07-27-2012, 12:23 PM
  4. filter records to populate form on load
    By rivereridanus in forum Forms
    Replies: 3
    Last Post: 08-05-2011, 08:54 AM
  5. Form - Filter on load (if data exists)
    By dilbert in forum Forms
    Replies: 0
    Last Post: 08-13-2010, 11:39 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