Query like condition

I have this part of code which could not work it gave message record not found, even value exist.
I am not sure what is wrong with like condition?
Is the problem Left outer join? I tried with Inner Join it is the same.


  Dim rst As DAO.Recordset
    Dim strBusName As String


    Set db = CurrentDb
    Dim strSQL As String


    If (Not IsNull(Me.txtBusinessName)) And Me.txtBusinessName.Value <> "" Then
        strBusName = Nz(Me.txtBusinessName, "")
        'strSQL = "Select * from tblContact WHERE LastName Like '" & strL_Name & "*'"

        strSQL = "Select * From tblContact Left Outer JOIN tblBusiness ON tblContact.ContactID = tblBusiness.ContactID WHERE tblBusiness.BusinessName Like '" & strBusName & " *'"
        Set rst = db.OpenRecordset(strSQL, dbOpenDynaset)
        If rst.BOF = True And rst.EOF = True Then  ' no record found
            MsgBox "No record found"
            rst.Close
            Set rst = Nothing
        Else      
Do something.
        End If
TarasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaauCommented:
Can you put this in a query, open it in the datasheet view and check if you really have the BusinessName you are looking for
Select tblBusiness.BusinessName From tblContact Left Outer JOIN tblBusiness ON tblContact.ContactID = tblBusiness.ContactID

Open in new window

0
IrogSintaCommented:
Looks like you have an extra space in your Like statement:
Like '" & strBusName & " *'"

Open in new window

should be
Like '" & strBusName & "*'"

Open in new window


Ron
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TarasAuthor Commented:
Thanks a lot. I need new glasses :-0
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.