Results 1 to 3 of 3
  1. #1
    kbell832 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    May 2020
    Posts
    1

    Need Help Creating a Form/Query Search combo


    Here's the deal. I have a table with records of writing topics. Each record consists of a different writing entry. I have fields for what document the piece is in, what page it is on, what position of the page it is (the first entry on the page, second entry, etc). Then I have three topic fields that are taken from the same list of topics stored in another table. I want to create a form and query where I can input a document/page/position combination, and have it find other entries that match the three topics for that record. All the googling I do seems to give me instructions for processes that are not what I want. Either that or I'm completely misunderstanding the terms for what I want to do. Please help.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    make a form that shows all records,
    put 3 text boxes in the header to do the filtering (search)
    the button Find will then filter what user entered:


    Code:
    '----------------
    sub btnFind_click()
    '----------------
    dim sWhere as string 
    
    sWhere = "1=1"
    if not IsNUll(txtDoc) then sWhere = sWhere & " and [Document]='" & txtDoc & "'"
    if not IsNUll(txtPage) then sWhere = sWhere & " and [Page]='" & txtPage & "'"
    if not IsNUll(txtPos) then sWhere = sWhere & " and [Position]='" & txtPos & "'"
    
    
    If sWhere = "1=1" Then
      Me.FilterOn = False
    Else
      Me.Filter = sWhere
      Me.FilterOn = True
    End If
    end sub

    or you can also use 'near' matches:
    if not IsNUll(txtDoc) then sWhere = sWhere & " and [Document] like '*" & txtDoc & "*'"

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    What processes have you read about?

    Only one record will match to document/page/position?
    So you need to locate record that matches document/page/position then get that record's 3 topics and apply another filter.

    This may give you help for the first part http://allenbrowne.com/ser-62.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 7
    Last Post: 11-20-2019, 11:30 AM
  2. Creating a search form with Combo Boxes
    By BakerMan in forum Access
    Replies: 28
    Last Post: 05-15-2019, 06:28 AM
  3. Replies: 5
    Last Post: 09-22-2016, 08:42 AM
  4. Replies: 2
    Last Post: 03-17-2014, 12:51 PM
  5. Creating a Search Form using query
    By sam.eade in forum Queries
    Replies: 2
    Last Post: 09-07-2013, 03:55 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