Can somebody get my SELECT statement to work??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Try
SELECT * FROM Customers WHERE Company LIKE [Enter A Company] & '*'

HTH;

Amy
 
SELECT Customers.*
FROM Customers
WHERE ((Customers.Company) Like "*" & [Company] & "*");

M
 
Thank you Amy! That worked perfectly!!

Ali

Amy Blankenship said:
Try
SELECT * FROM Customers WHERE Company LIKE [Enter A Company] & '*'

HTH;

Amy

MeWivFree said:
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
 
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




Amy Blankenship said:
Try
SELECT * FROM Customers WHERE Company LIKE [Enter A Company] & '*'

HTH;

Amy

MeWivFree said:
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
 
Hiya

Thanks very much for that reply!! :)

Ali

Someone said:
SELECT Customers.*
FROM Customers
WHERE ((Customers.Company) Like "*" & [Company] & "*");

M

MeWivFree said:
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
 
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


Amy Blankenship said:
Try
SELECT * FROM Customers WHERE Company LIKE [Enter A Company] & '*'

HTH;

Amy

MeWivFree said:
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
 
No problem - I'm glad it helped you :)


MeWivFree said:
Hiya

Thanks very much for that reply!! :)

Ali

Someone said:
SELECT Customers.*
FROM Customers
WHERE ((Customers.Company) Like "*" & [Company] & "*");

M

MeWivFree said:
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
 
Back
Top