ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Import from Acess problems with SQL language (https://www.excelbanter.com/excel-discussion-misc-queries/246605-import-acess-problems-sql-language.html)

toby131

Import from Acess problems with SQL language
 
I have a query in access where I use SQL code to calculate a field. In the
SQL code I have a series of if statments that use * to represent any
character and # to represent any number. The query outputs the correct
results in Access. When I import this to excel, it does not correctly
interpret the * or #, so outputs my "then" from the if statement. Is there
somewhere in Excel 2003 that I can change the language it is using to
recognize the * & #?

For clarification, here is an example:

IIf([Type] like "8##*, "800", "x")

Results in Access
Type Result
825XY 800
650ZX x
875YX 800

Results I am getting in Excel
Type Result
825XY x
650ZX x
875YX x

Thanks!

Matrix416

Quote:

Originally Posted by toby131 (Post 894463)
I have a query in access where I use SQL code to calculate a field. In the
SQL code I have a series of if statments that use * to represent any
character and # to represent any number. The query outputs the correct
results in Access. When I import this to excel, it does not correctly
interpret the * or #, so outputs my "then" from the if statement. Is there
somewhere in Excel 2003 that I can change the language it is using to
recognize the * & #?

For clarification, here is an example:

IIf([Type] like "8##*, "800", "x")

Results in Access
Type Result
825XY 800
650ZX x
875YX 800

Results I am getting in Excel
Type Result
825XY x
650ZX x
875YX x

Thanks!

Toby131
Are you using MS query to import your data?
Although Access and Excel are both microsoft products their use of wildcards strangely differs. Access is "*" and Excel is "%"
2 options are to run the query first in Access as a create table query then import the results to Excel. You can automate the whole procedure with a macro.
Or Swap the wild cards in Access to those compatible to Excels MS query.


All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com