Jumat, 27 Januari 2012

Re: [MS_AccessPros] Textual Search

 

This is a section based on the search 2000 from Allen Browne
 
     If Not IsNull(Me.txtField) Then
        strWhere = strWhere & "([Description] Like ""*" & Me.txtField & "*"") AND "
       ' MsgBox "SQL: " & strWhere
    End If
     
    '***********************************************************************
    'Chop off the trailing " AND ", and use the string as the form's Filter.
    '***********************************************************************
    'See if the string has more than 5 characters (a trailng " AND ") to remove.
    lngLen = Len(strWhere) - 5
    If lngLen <= 0 Then     'Nah: there was nothing in the string.
        MsgBox "No criteria", vbInformation, "Nothing to do."
    Else                    'Yep: there is something there, so remove the " AND " at the end.
        strWhere = Left$(strWhere, lngLen)
               
        'Finally, apply the string as the form's Filter.
        Me.Filter = strWhere
        Me.FilterOn = True
    End If

Take care, Michael Simpson Sac City Plumbing 3031 E St. Sacramento, CA 95816 Phone: (916) 837-2211  Fax: (801) 681-0382

From: mithomas48 <no_reply@yahoogroups.com>
>To: MS_Access_Professionals@yahoogroups.com
>Sent: Friday, January 27, 2012 7:55 AM
>Subject: [MS_AccessPros] Textual Search
>
>

>Is there a simple way with a function or such to locate a text string within another text string? For example...
>
>Text String 1 = "Need to search this string."
>Search Criteria = "search"
>
>So is there a quick and simple way to find the word "search" within Text String 1?
>
>Thanks in advance!
>Mike
>
>
>
>
>

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___

Tidak ada komentar:

Posting Komentar