Question : Ms access SQL Select Like Query Error.

Hi there,

I am have a slight problem with my Select LIKE statement. I have attached a screenshot for a better understanding.

I have tried following the advice on microsft's page, however it still does not work. Hope you can advice me on what should i do. Thanks.

My button's Code below:

Code Snippet:
1:
2:
3:
4:
5:
6:
Private Sub btnSearchByActors_Click()
 
    Me.listboxMovieListing.RowSource = "SELECT Movies.MovieId, Movies.Title, Movies.UnitRentalFee, Movies.Ratings, Movies.Qty FROM Movies WHERE Movies.Actors LIKE " & "*" & Forms!fmMoviesAvailableForRent!tbxMovieActors & " * "
    Me.listboxMovieListing.Requery
    
End Sub
Open in New Window Select All

Answer : Ms access SQL Select Like Query Error.

I agree, you are missing the string quotes for the query.
you also had a space before the second *.
1:
2:
3:
4:
5:
6:
Private Sub btnSearchByActors_Click()
 
    Me.listboxMovieListing.RowSource = "SELECT Movies.MovieId, Movies.Title, Movies.UnitRentalFee, Movies.Ratings, Movies.Qty FROM Movies WHERE Movies.Actors LIKE '*" & Forms!fmMoviesAvailableForRent!tbxMovieActors & "*' "
    Me.listboxMovieListing.Requery
    
End Sub
Open in New Window Select All
Random Solutions  
 
programming4us programming4us