Results 1 to 3 of 3
  1. #1
    czintak is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2019
    Posts
    6

    Adding more search

    Dear All,
    Trying to make this code work. Was wanting to add 2 more search fields to the Form. These would act as a narrowing field. Search one would filter the query. Second would filter that filter. Third would filter filter filter. I'm running into the issue it cant ignore the 2 blank fields when they are not in use. I have attached my code and File.
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    use a continuous form to show all records,
    then when the user fills in the boxes, then clicks the FIND button, use vb to build the where clause:
    Code:
    sub btnFind_click()
    dim sWhere as string
    sWhere = "1=1"
    if not IsNull(txtBox1) then sWhere = sWhere & " and [field1]='" & me.txtBox1 & "'"
    if not IsNull(txtBox2) then sWhere = sWhere & " and [field2]='" & me.txtBox2 & "'"
    if not IsNull(cboBox) then sWhere = sWhere & " and [field3]='" & me.cboBox & "'"
    if sWhere = "1=1" then
       me.filterOn = false
    else
       me.filter = sWhere
       me.filterOn = true
    endif

  3. #3
    czintak is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2019
    Posts
    6
    I think this will get me along the correct path. Going to have to do a little rebuild to fit that way in but I think I can make it work. Thanks for all the help

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

Similar Threads

  1. Replies: 8
    Last Post: 06-06-2014, 09:48 AM
  2. Adding Cascading Combo to my Search Form
    By rescobar in forum Forms
    Replies: 9
    Last Post: 08-16-2013, 10:10 AM
  3. Replies: 1
    Last Post: 08-06-2013, 07:52 PM
  4. Adding a search form
    By sevanty7 in forum Forms
    Replies: 1
    Last Post: 05-03-2013, 09:08 AM
  5. Search result links adding extra info
    By Vbcw in forum Programming
    Replies: 0
    Last Post: 12-19-2008, 12:19 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