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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access / VB Error when changing SQL

Status
Not open for further replies.

speial

Programmer
May 5, 2003
15
US
Hello, I am modifying an existing Access / VB application and need to make a simple change to an SQL Query. I open the query and select SQL. I see the SQL. I make the change and save. No issues so far....

When I run the applicaion I get an SQL error that does not reflect my change. So.. I did a test and simply added a singe space at the end of the SQL statement. I recevied the same error.

Microsoft says I should be able to cut and paste SQL directly into the editor and save....

Is there a special way I must edit existing SQL ?

 



Hi,

Please post your code. Include the SQL and how you execute.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I am unable to post / attach documents.
 


You just COPY 'n' PASTE your code. Plain and simple!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I took screen shots and they would not paste into the forum window. I wanted to show the steps and the code.


Here is the code
++++

SELECT [Expr2] & "," & [Expr1] & ",ABC,state,Data_StateExtended,,,,,,,,&tsid:" & Int([Expr3]/500) AS Expr4
FROM [SELECT [OMS_ID] as Expr1, [ICCP Export point] as Expr2, [Data_set] as Expr3
FROM breaker_out
UNION
SELECT [OMS_ID] as Expr1, [ICCP Export point] as Expr2, [Data_set] as Expr3
FROM switch_out
UNION SELECT [OMS_ID] as Expr1,[ICCP Export point] as Expr2, [Data_set] as Expr3
FROM recloser_out
]. AS Q1
WHERE (((Q1.Expr1) Not In (SELECT [Q2].Expr1
FROM
(SELECT [OMS_ID] as Expr1, [ICCP Export point] as Expr2
FROM breaker_out
UNION
SELECT [OMS_ID] as Expr1, [ICCP Export point] as Expr2
FROM switch_out
UNION
SELECT [OMS_ID] as Expr1,[ICCP Export point] as Expr2
FROM recloser_out
) AS [Q2]
GROUP BY [Q2].Expr1
HAVING (((Count(*))>1))
)) AND ((Q1.Expr2) Not In (SELECT [Q2].Expr2
FROM
(SELECT [OMS_ID] as Expr1, [ICCP Export point] as Expr2
FROM breaker_out
UNION
SELECT [OMS_ID] as Expr1, [ICCP Export point] as Expr2
FROM switch_out
UNION
SELECT [OMS_ID] as Expr1,[ICCP Export point] as Expr2
FROM recloser_out
) AS [Q2]
GROUP BY [Q2].Expr2
HAVING (((Count(*))>1))
)));


++++

I am running the code via a form. this is the code in the form.


DoCmd.TransferText acExportDelim, "All_unique_out Export Specification", "All_unique_out", sFilePath, False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top