Results 1 to 3 of 3
  1. #1
    jake7363 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2016
    Posts
    13

    Create dynamic filter in a tabular form.

    Hello,

    I'm a bit shy on the experience level, perhaps slightly past novice. So, the question I have might seem peculiar, but here goes...

    I am trying to create a filter within a tabular form that allows the user to enter the criteria in a text box for a given field. Example: Calling the field "Vendor" and a list of vendors populate that field. I would like the user to enter "Amazon" within the text box so the tabular form shows the result of all records for which the Vendor is Amazon. The filter can be cleared, allowing a return to the full dataset. Perhaps the next time, the Vendor is "Home Depot," and so on.

    Is this possible? If so, how is it done?
    I'll be grateful for all replies...

    Cheers,


    Jake

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    in the header part of the continuous form (or other)
    put in the unbound boxes to filter by.
    then when user clicks FIND (or other word), set the filter:

    Code:
    Public Sub btnFIND_Click()
    Dim sSql As String, sWhere As String
    
    
    sWhere = "1=1"
    
    
        'the query is built depending on the various filters the user picks...
    If Not IsNull(cboState) Then sWhere = sWhere & " and [state]='" & cboState & "'"
    If Not IsNull(txtName) Then sWhere = sWhere & " and [Name]='" & txtName & "'"
    If Not IsNull(chkContact) Then sWhere = sWhere & " and [Contact]=" & chkContact.Value
    
    
     'use it to filer the form records
    if sWhere = "1=1" then
      me.filterOn = false
    else
      me.filter = sWhere
      me.filterOn = true
    endif
    END SUB

  3. #3
    jake7363 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2016
    Posts
    13
    Thanks for the quick post! I'll give it a run and see how it does...

    Cheers.

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

Similar Threads

  1. Replies: 2
    Last Post: 05-31-2023, 04:25 AM
  2. Add dynamic filter in query
    By elbartje in forum Access
    Replies: 10
    Last Post: 03-05-2017, 10:41 AM
  3. Replies: 2
    Last Post: 02-19-2015, 03:29 PM
  4. Replies: 3
    Last Post: 11-27-2012, 07:20 AM
  5. Create Form with Tabs In Tabular Layout
    By zool.hilmi in forum Forms
    Replies: 1
    Last Post: 06-13-2012, 04:48 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