|
Subject:
|
ALike
|
|
Posted By:
|
elansolutionsltd
|
Post Date:
|
2/14/2006 12:56:36 PM
|
This is so basic that I'm almost embarrassed to ask, but I b******d if I can find the answer.
I have a piece of SQL in a small module that sets the RecordSource of a form depending on a value entered in a text box
SELECT * FROM tbl_employees WHERE [Name] Like '*mc*' ORDER BY Eenum;
Simple, no problems. I use the Like operator as we need to do wildcard searches of employees. This has been running well for months, but suddenly yesterday it kept reporting no records found. I copied the SQL into a query and looked at it in design view, only to discover that the 'Like' operator was been changed to 'ALike'. I have been playing with Access for years, but have never seen or used this before. In other databases, the Like operator still performs as it ought, but even on other tables in the problem database, all queries that contain 'Like' will not run.
We have recently upgraded to Access 2003 from 2000. Is this causing it?
Help!
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
2/15/2006 7:50:47 AM
|
This was the only info I could find on this undocumented issue:
"Using ADO wildcards in the query design grid Making the necessary adjustments to change DAO wildcards to ADO wildcards may be a simple task, but if you're using ADO wildcards in your code you may prefer to also do so in the query design grid. Although it's undocumented, there is a way to use ADO wildcards in Access 2000's query design grid. Instead of using the Like operator, use ALike. For instance, you could use the criteria
ALike "_r_s__n%"
to replace our previous Kreskin example. The ALike operator works in SQL statements used in code as well, allowing you to easily take advantage of using the query design grid to create SQL statements."
From: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnima01/html/ima0601.asp
HTH
mmcdonal
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
2/15/2006 7:52:29 AM
|
Reading my own post it seems that if you get into this problem, use the SQL wild card character "%" instead of the Access SQL wild card "*".
HTH
mmcdonal
|