Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does the... & "*"... represent in the following statement? 1

Status
Not open for further replies.

soorags

MIS
Mar 19, 2007
44
0
0
GB
SELECT [UK Table].[Business Name], [UK Table].[Business Type], [UK Table].Address, [UK Table].City, [UK Table].Country, [UK Table].[Telephone Number], [UK Table].[Website Address], [UK Table].[Email Address]
FROM [UK Table]
WHERE (([UK Table].[Business Name] Like Forms!frmNz!txtBusinessName & "*") Or (Forms!frmNz!txtBusinessName Is Null)) And (([UK Table].[Business Type] Like Forms!frmNz!txtBusinessType & "*") Or (Forms!frmNz!txtBusinessType Is Null)) And (([UK Table].Address Like Forms!frmNz!txtAddress & "*") Or (Forms!frmNz!txtAddress Is Null)) And (([UK Table].City Like Forms!frmNz!txtCity & "*") Or (Forms!frmNz!txtCity Is Null)) And (([UK Table].Country Like Forms!frmNz!txtCountry & "*") Or (Forms!frmNz!txtCountry Is Null)) And (([UK Table].[Telephone Number] Like Forms!frmNz!txtTelephoneNumber & "*") Or (Forms!frmNz!txtTelephoneNumber Is Null)) And (([UK Table].[Website Address] Like Forms!frmNz!txtWebsiteAddress & "*") Or (Forms!frmNz!txtWebsiteAddress Is Null)) And (([UK Table].[Email Address] Like Forms!frmNz!txtEmailAddress & "*") Or (Forms!frmNz!txtEmailAddress Is Null));

I have used this query but fail to know what the & "*" part means. What does it do? What does it mean?
 
when you use the LIKE operator you have to include the * (in JET/SQL or the % in other SQL flavors).

LIKE "AC*" find all records where the field starts with AC:
Account
Access

LIKE "*AC" find all records where the field ends with AC:
Lilac
Prozac

LIKE "*AC*" find all records that contain AC
Account
Access
Back
Pack
Lilac
Prozac

In your query the value from the form frmNz in the edit box txtEmailAddress is filled into the query so it ends up being:

Code:
And (([UK Table].[Email Address] Like Forms!frmNz!txtEmailAddress & "*")

And (([UK Table].[Email Address] Like "emailAddress@yahoo.com*")

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top