Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ms access SQL Select Like Query Error.

Posted on 2008-10-18
6
Medium Priority
?
843 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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

A new era in Cloud training has arrived.

A day that will go down in Cloud history.. But are you ready for it? Will you accept this Cloud challenge?

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

688 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