A family of Microsoft relational database management systems designed for ease of use.
Hi Nick,
When you link to a SQL Server table within Access, you will make use of the Access Database Engine when querying that linked table. Because of this, you will make use of the same wild card characters that Access normally makes use of. For example, like “A*” would return all the data that begins with the letter A. This will also work if you run a query against a local Access table. However, Excel, makes use of a different wild card character because it uses the ANSI 92 standard. Thus, if you want to use wild cards in query that is run within Excel, you will have to make use of the % wild card sign. This % wild card sign will only bring back the expected results when the query is run from Excel or if you change the setting I mentioned. If you don’t change this setting and run the query from Access, you will get unexpected results. As you have seen, when you change this setting within Access the criteria changes to Alike “A*”, which doesn’t produce the same results as it did before. If you want this query to run within Access and show all records that start with the letter A, the syntax would be ALIKE “A%”. The reason you have to change the * to a % is because you told Access to make use of a different ANSI standard, which in turn tells it to use a different wild card character.
So in summary:
+>If you want to make use of an Access query within Excel or make use of wild card characters within Excel, you will need to make use of the % wild card.
+>If you want to run this same query within Access, you will need to use the * wild card to get the same results.
+>If you want the query to run within Excel and in Access, you will need to make use of the % wild card sign and also change the setting I mentioned. After changing this setting, you will need to ensure you change the wild cards in your old queries to %.
+>The other option would be to have two queries and not change the setting at all. You could then make use of a * wild card in Access. The second query would make use of the % wild card. The second query would not return the expected results from within Access, but when you run it from Excel it should work.
As far as Excel goes, I believe you can find MS Query by opening your Excel file and then click on the data tab and then within the “Get External Data” section click on From Other Sources -> From MS Query.
Best Regards,
Nathan O.
Microsoft Online Community Support