Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / December 2005

Tip: Looking for answers? Try searching our database.

Can somebody get my SELECT statement to work??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MeWivFree - 08 Dec 2005 01:03 GMT
Hi there

I have a table called Customers and currently use the following SQL
statement to search for a company within the table:

PARAMETERS [Company] Text( 50 );
SELECT *
FROM Customers
WHERE Customers.Company = [Company];

However, I'd also like it to throw up results based on a partial company
name too, to save me having to type in the whole name every time.

I've been playing around with various versions of:

WHERE Customers.Company LIKE "[Company]%"

but I can't get anything to work!

Can somebody help me?

Thanks!

Ali
Amy Blankenship - 08 Dec 2005 01:11 GMT
Try
SELECT * FROM Customers WHERE Company LIKE [Enter A Company] & '*'

HTH;

Amy

> Hi there
>
[quoted text clipped - 20 lines]
>
> Ali
MeWivFree - 08 Dec 2005 01:21 GMT
Thank you Amy!  That worked perfectly!!

Ali

> Try
> SELECT * FROM Customers WHERE Company LIKE [Enter A Company] & '*'
[quoted text clipped - 27 lines]
> >
> > Ali
MeWivFree - 08 Dec 2005 21:11 GMT
Hi Amy

I don't suppose you could help me with this query again?

I was quite happy with the way it works but "the powers that be" asked me if
it would pick up a company name based on any of the words in the company name.

For example, if we have a company called "The Widget Group", they want to be
able to search on the word "Widget" and still be able to find it.

How would I amend the query to do that?

Ali

> Try
> SELECT * FROM Customers WHERE Company LIKE [Enter A Company] & '*'
[quoted text clipped - 27 lines]
> >
> > Ali
MeWivFree - 08 Dec 2005 21:16 GMT
Hi again

Ignore my last post to you - I see that "Someone" has given me the answer to
my question below.

Sorry for bothering you...

Ali

> Try
> SELECT * FROM Customers WHERE Company LIKE [Enter A Company] & '*'
[quoted text clipped - 27 lines]
> >
> > Ali
Someone - 08 Dec 2005 01:18 GMT
SELECT Customers.*
FROM Customers
WHERE ((Customers.Company) Like "*" & [Company] & "*");

M

> Hi there
>
[quoted text clipped - 20 lines]
>
> Ali
MeWivFree - 08 Dec 2005 21:15 GMT
Hiya

Thanks very much for that reply!! :)

Ali

> SELECT Customers.*
> FROM Customers
[quoted text clipped - 26 lines]
> >
> > Ali
Someone - 08 Dec 2005 23:50 GMT
No problem - I'm glad it helped you :)

> Hiya
>
[quoted text clipped - 33 lines]
>> >
>> > Ali
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.