Results 1 to 5 of 5
  1. #1
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91

    VBA coding to filter data


    I have to two fields popmin and popmax, that uses one textbox.

    The text box suppose work for example, say there data population of 15 to 80.
    if someone enters 20 is 20 >= 15? T or 20 <= 80? T
    If someone enters 100 is 100 >= 15? T or is 100 <= 80? F

    Then it will show all the data in those ranges.

    What be the best vba coding for this type of statement?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    you want 2 text boxes.
    txtBoxMin, txtBoxMax

    and a button to activate the filter:
    Code:
    sub txtButton_click()
    
    
       Me.Filter = "[population] between " & me.txtBoxMin & " and " & me.txtBoxMax
       Me.FilterOn = True
    
    
    end sub
    turn the filter off using the APPLY FILTER button on the toolbar.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    There is not enough info to create any code.

    Where is "....data population of 15 to 80."? A form, a query, a table???


    Then it will show all the data in those ranges.
    Shows it where???

  4. #4
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Population is in a query and it show the results in a listbox on a new page.

  5. #5
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Quote Originally Posted by ssanfu View Post
    There is not enough info to create any code.

    Where is "....data population of 15 to 80."? A form, a query, a table???



    Shows it where???
    Population is in a query and it will show the results in a listbox on a new page.

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

Similar Threads

  1. Coding to export data from single record to Word Bookmarks
    By Fatmonkeymedia in forum Programming
    Replies: 5
    Last Post: 12-01-2016, 10:39 PM
  2. Replies: 21
    Last Post: 04-29-2015, 11:57 PM
  3. Replies: 4
    Last Post: 10-06-2014, 02:40 PM
  4. Appending data using coding..!!
    By desiretolearn in forum Programming
    Replies: 3
    Last Post: 06-09-2014, 10:31 AM
  5. parsing data in access (coding?)
    By banker247 in forum Programming
    Replies: 0
    Last Post: 01-13-2009, 12:05 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