Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SQL From Access Not Working

Hello,
The following SQL statement Access created after I made a querry in
design mode. The Access database is connected to Oracle.

I copied the SQL statement from the Access querry and pasted into
range("A1")

Here's how the Excel connection is being made:

With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=XXXX;UID=XXXX;PWD=####;SERVER=XXXX; (i removed the
actual names)

For the CommandText I am referencing cell A1, which contains the
following SQL statement.
This returns an error and won't execute.
Any ideas.
Thank you.

Sql From Access

SELECT PROD_ADDR.ADDR_NO, PROD_CUST_ADDR.CUST_NO,
PROD_CUST.USER_CUST_NO, PROD_CUST.CUST_NAME,
PROD_CUST_ADDR_FUNC_CD.CUST_ADDR_FUNC_CD, PROD_ADDR_LN.ADDR_LN_NO,
PROD_ADDR_LN.ADDR_LN_TXT, PROD_ADDR.CITY, PROD_ADDR.STATE_CD,
PROD_ADDR.ZIP
FROM ((PROD_CUST INNER JOIN (PROD_ADDR INNER JOIN PROD_CUST_ADDR ON
PROD_ADDR.ADDR_NO = PROD_CUST_ADDR.ADDR_NO) ON PROD_CUST.CUST_NO =
PROD_CUST_ADDR.CUST_NO) INNER JOIN (PROD_CUST_ADDR_FUNC_CD INNER JOIN
PROD_CUST_ADDR_FUNC_REL ON PROD_CUST_ADDR_FUNC_CD.CUST_ADDR_FUNC_CD =
PROD_CUST_ADDR_FUNC_REL.CUST_ADDR_FUNC_CD) ON (PROD_ADDR.ADDR_NO =
PROD_CUST_ADDR_FUNC_REL.ADDR_NO) AND (PROD_CUST_ADDR.CUST_NO =
PROD_CUST_ADDR_FUNC_REL.CUST_NO)) INNER JOIN PROD_ADDR_LN ON
PROD_ADDR.ADDR_NO = PROD_ADDR_LN.ADDR_NO
WHERE (((PROD_CUST_ADDR_FUNC_CD.CUST_ADDR_FUNC_CD)="BILL TO"))
ORDER BY PROD_CUST.CUST_NAME;

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default SQL From Access Not Working

See example 4 in this article:

http://support.microsoft.com/kb/105416/en-us

--
Regards,
Tom Ogilvy


" wrote:

Hello,
The following SQL statement Access created after I made a querry in
design mode. The Access database is connected to Oracle.

I copied the SQL statement from the Access querry and pasted into
range("A1")

Here's how the Excel connection is being made:

With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=XXXX;UID=XXXX;PWD=####;SERVER=XXXX; (i removed the
actual names)

For the CommandText I am referencing cell A1, which contains the
following SQL statement.
This returns an error and won't execute.
Any ideas.
Thank you.

Sql From Access

SELECT PROD_ADDR.ADDR_NO, PROD_CUST_ADDR.CUST_NO,
PROD_CUST.USER_CUST_NO, PROD_CUST.CUST_NAME,
PROD_CUST_ADDR_FUNC_CD.CUST_ADDR_FUNC_CD, PROD_ADDR_LN.ADDR_LN_NO,
PROD_ADDR_LN.ADDR_LN_TXT, PROD_ADDR.CITY, PROD_ADDR.STATE_CD,
PROD_ADDR.ZIP
FROM ((PROD_CUST INNER JOIN (PROD_ADDR INNER JOIN PROD_CUST_ADDR ON
PROD_ADDR.ADDR_NO = PROD_CUST_ADDR.ADDR_NO) ON PROD_CUST.CUST_NO =
PROD_CUST_ADDR.CUST_NO) INNER JOIN (PROD_CUST_ADDR_FUNC_CD INNER JOIN
PROD_CUST_ADDR_FUNC_REL ON PROD_CUST_ADDR_FUNC_CD.CUST_ADDR_FUNC_CD =
PROD_CUST_ADDR_FUNC_REL.CUST_ADDR_FUNC_CD) ON (PROD_ADDR.ADDR_NO =
PROD_CUST_ADDR_FUNC_REL.ADDR_NO) AND (PROD_CUST_ADDR.CUST_NO =
PROD_CUST_ADDR_FUNC_REL.CUST_NO)) INNER JOIN PROD_ADDR_LN ON
PROD_ADDR.ADDR_NO = PROD_ADDR_LN.ADDR_NO
WHERE (((PROD_CUST_ADDR_FUNC_CD.CUST_ADDR_FUNC_CD)="BILL TO"))
ORDER BY PROD_CUST.CUST_NAME;


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel link to access query not working richard Excel Discussion (Misc queries) 0 February 19th 09 06:11 AM
Lookups in Excel on Data from Access not working goldcd_2 Excel Worksheet Functions 2 January 31st 07 06:01 PM
Working with Access Dabatabases through VBA Codes in Excel Dennis Excel Programming 2 August 30th 05 09:49 PM
Working with protected Databases Access through Excel Dennis Excel Programming 2 August 16th 05 10:36 PM
Wondering why the following ADO connection to Access isn't working... [email protected] Excel Programming 6 February 10th 05 08:55 AM


All times are GMT +1. The time now is 02:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"