Results 1 to 5 of 5
  1. #1
    Rizvi is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    12

    How to display records in a form for a specific criteria

    Hi, if anybody can help me out i am new to access. i have created a form in which there is also a sub form displaying all the records of the table. when selecting record in the list displayed in sub form the form is updated with that record. the problem i am facing that i am not able to filter the records of sub form on a criteria. i have a field in the table "Authorized" which is Yes/No attribute and i need only those records where the value of "Authorized" field is to be displayed when the form is loaded.
    if any body can help me out
    thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    instead of a subform, you should just use a form.
    Subforms are for showing filtered of the item in the master form.

    You said yours shows all records.
    "Authorized" is 3 settings: Yes/No AND both.

    If you DONT use a sub form, then you only need put the tick boxes on the header, then:

    Code:
    sub chkAuthorized_Afterupdate()
      Me.Filter = "[Authorized]=" & chkAuthorized.value 
      Me.FilterOn = True
    end sub


    then click the TOOGLE FILTER button on the main menu bar to show all records.

  3. #3
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Deleted...

  4. #4
    Rizvi is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    12
    thanks for the reply. attaching screen shot of my form. if you can see the form is split in datasheet and form. i already have the following code which runs when the record is selected in the list.
    Private Sub Form_Current()
    Me.Parent.Filter = "Txn_number=" & Txn_number
    Me.Parent.FilterOn = True
    End Sub
    if you can help me out in this. i only need when this form is loaded it should only display the records where "Authorized" field is not "ticked" or value "No"Doc1.pdf

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    is parent the subform name? (if it is, why would it be called 'parent'?)
    your tick box is IN the parent form so it would be:

    me.filter = "Txn_number=" & Txn_number
    me.FilterOn = true

    if you want to filter the subform (use the BUILDER to get the path correct)
    but it may be:

    me.subform.form.filter = "Txn_number=" & Txn_number
    ​me.subform.form.FilterOn = true

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

Similar Threads

  1. Replies: 10
    Last Post: 07-10-2017, 07:36 AM
  2. Replies: 3
    Last Post: 11-28-2016, 03:17 PM
  3. Replies: 6
    Last Post: 07-27-2015, 10:23 AM
  4. Replies: 2
    Last Post: 04-27-2010, 01:25 PM
  5. Replies: 1
    Last Post: 04-11-2010, 04:05 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