Solved

Ms access SQL Select Like Query Error.

Posted on 2008-10-18
6
836 Views
Last Modified: 2013-11-28
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:


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-like-screenshot.jpg
0
Comment
Question by:applefruit
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:Benji_
ID: 22747573
i belive you are missing a ' from each side of the statement,

eg select field1,field2 from table where  field1 like 'result%'

% as a wildcard
0
 

Author Comment

by:applefruit
ID: 22747594
Hi i dont really understand what you mean. Can you maybe show me an example using my codes?

This is the site that i took reference from, they said that the wild card should be * instead of % correct?
0
 

Author Comment

by:applefruit
ID: 22747595
This is the site i took reference from http://support.microsoft.com/kb/294954,
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22747596
I agree, you are missing the string quotes for the query.
you also had a space before the second *.

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

0
 
LVL 2

Expert Comment

by:Benji_
ID: 22747604
angel got there before me:D
0
 

Author Comment

by:applefruit
ID: 22747656
THANKS
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

777 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