[Last Call] Learn how to a build a cloud-first strategyRegister Now


Why doesn't this fuzzy search in vb6 work?  How can I change this to make it work?

Posted on 2007-10-09
Medium Priority
Last Modified: 2007-10-10
Why doesn't this fuzzy search in vb6 work?  How can I change this to make it work?

If "cerebral" Like "*cere" Then
MsgBox "these are the same"
End If
Question by:blackbookcoder2
LVL 38

Accepted Solution

PaulHews earned 2000 total points
ID: 20045226
The wildcard * is a stand in for other characters... in this case, any other characters.  These would be true:

Private Sub Command1_Click()

    If "cerebral dancing monkey" Like "cere*" Then
        MsgBox "alike"
    End If
        If "cerebral" Like "cere*" Then
        MsgBox "alike"
    End If

    If "cereal" Like "cere*" Then
        MsgBox "alike"
    End If

End Sub

Putting the * at the beginning of the string would match any character at the beginning of the string.  For example:

If "This is a test" Like "*a test" Then
  Msgbox "alike"
End If

But an asterix at the beginning cannot match characters at the end of the string as in your example...

Author Comment

ID: 20053032
PaulHews, thanks for your help.  Sincerely, blackbookcoder2

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question