Results 1 to 8 of 8
  1. #1
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568

    Multisearch textboxes on split form

    Hi

    i have multisearch textboxes on my split form:

    Click image for larger version. 

Name:	split form.png 
Views:	22 
Size:	21.3 KB 
ID:	31268

    My split form is build on query:

    Code:
    SELECT tbl_Slownik.Slownik_ID, tbl_Slownik.PESEL, tbl_Slownik.Person_ID, tbl_Slownik.Nazwisko_imie, tbl_Slownik.Department, tbl_Slownik.Company_NIP, tbl_Slownik.Company_name, tbl_Slownik.Company_shortcut, tbl_Slownik.System, tbl_Slownik.Aktualna
    FROM tbl_Slownik
    WHERE (((tbl_Slownik.PESEL) Like "*" & [Formularze]![tbl_Korekty]![Txb_pesel] & "*" Or (tbl_Slownik.PESEL) Is Null) AND ((tbl_Slownik.Person_ID) Like "*" & [Formularze]![tbl_Korekty]![Txb_person_id] & "*" Or (tbl_Slownik.Person_ID) Is Null) AND ((tbl_Slownik.Nazwisko_imie) Like "*" & [Formularze]![tbl_Korekty]![Txb_nazwisko_imie] & "*" Or (tbl_Slownik.Nazwisko_imie) Is Null) AND ((tbl_Slownik.Company_NIP) Like "*" & [Formularze]![tbl_Korekty]![Txb_company_NIP] & "*" Or (tbl_Slownik.Company_NIP) Is Null) AND ((tbl_Slownik.Company_name) Like "*" & [Formularze]![tbl_Korekty]![Txb_company_name] & "*" Or (tbl_Slownik.Company_name) Is Null) AND ((tbl_Slownik.Company_shortcut) Like "*" & [Formularze]![tbl_Korekty]![Txb_company_shortcut] & "*" Or (tbl_Slownik.Company_shortcut) Is Null)) OR ((("Or") Like "" & [Formularze]![tbl_Korekty]![Txb_pesel] & "" And ("Or") Like "" & [Formularze]![tbl_Korekty]![Txb_person_id] & "" And ("Or") Like "" & [Formularze]![tbl_Korekty]![Txb_nazwisko_imie] & "" And ("Or") Like "" & [Formularze]![tbl_Korekty]![Txb_company_NIP] & "" And ("Or") Like "" & [Formularze]![tbl_Korekty]![Txb_company_name] & "" And ("Or") Like "" & [Formularze]![tbl_Korekty]![Txb_company_shortcut] & "" And ("Or") Like "" & [Formularze]![tbl_Korekty]![Txb_pesel] & ""));

    It is working fine but problem is when user inputs string which is not presented within where clause in my query, for example "dasdkhjasdklshjadk" into one of textbox.
    Then my filtered split form looks like below:



    Click image for larger version. 

Name:	nothing.png 
Views:	22 
Size:	27.6 KB 
ID:	31269

    any quick method to return to source query look?
    To show whole query table without filters?

    Thank you for helping me,
    Best Wishes,
    Jacek

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    build the 'where' clause by cycling thru all the controls....
    it executes after a find button CLICK event
    if null, ignore.
    if not, apply.


    Code:
    '----------------
    sub btnFilter_click()
    '----------------
    dim sWhere as string 
    
    
    sWhere = "1=1"
    if not IsNUll(cboST) then sWhere = sWhere & " and [State]='" & cboST & "'"
    if not IsNUll(cboCity) then sWhere = sWhere & " and [city]='" & cboCity & "'"
    if not IsNUll(cboZip) then sWhere = sWhere & " and [ZipCode]='" & cboZip & "'"
    
    
    If sWhere = "1=1" Then
      Me.FilterOn = False
    Else
      Me.Filter = sWhere
      Me.FilterOn = True
    End If
    end sub

  3. #3
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Hi ranman256,

    thank you.

    My button with magnifying glass code is :

    Code:
     Me.Requery
    so your code will not bring my query to life again.
    But it is an alternative to my code.

    You can see that in my quere there are expresiions like:

    WHERE (((tbl_Slownik.PESEL) Like "*" & [Formularze]![tbl_Korekty]![Txb_pesel] & "*" Or (tbl_Slownik.PESEL) Is Null)
    So thanks to it i can write first letter of name and all matching results will be shown.

    These textboxes on form are used as where clause in query. And this is how it is working.

    Best Wishes,
    Jacek

  4. #4
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Anyone?

    Jacek

  5. #5
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Hi,

    anybodY?

    Jacek

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Create a simple query that will fulfill your requirements and show all the records, then have a refresh button on the form and use this query as your record source.

  7. #7
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    My button with magnifying glass code is:
    You need to have code to determine if no records are returned by your criteria:
    Code:
    If Me.RecordsetClone.RecordCount = 0 Then
            ' set your search textboxes to null here
            MsgBox "No records"
        End If
        me.requery

  8. #8
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Thank you Guys,

    So I found the solution.

    First i am requerying split form and if recordcount = 0 then...
    and once again reauery

    Thank you !

    Jacek

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

Similar Threads

  1. Replies: 3
    Last Post: 11-03-2015, 11:19 PM
  2. two textboxes in form to one cell in table
    By WickidWe in forum Forms
    Replies: 2
    Last Post: 12-12-2013, 05:25 PM
  3. All Textboxes Read-Only on Form
    By cbrsix in forum Programming
    Replies: 5
    Last Post: 04-16-2013, 01:47 PM
  4. Just numeric input for all textboxes in the form
    By amd711 in forum Programming
    Replies: 7
    Last Post: 11-27-2012, 08:08 AM
  5. Form - CANNOT EDIT TEXTBOXES !!!
    By dbalilti in forum Access
    Replies: 5
    Last Post: 07-05-2012, 12:15 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