Thread: Edit Query
View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
M. Byford[_2_] M. Byford[_2_] is offline
external usenet poster
 
Posts: 7
Default Edit Query

I tried .CommandText = Array("SELECT *" & vbCrLf & FromSQL) and got past the
Error 13 but it stopped with an ODBC error on the Refresh line.

I changed to .CommandText = Array(SelectSQL & vbCrLf & FromSQL) and got as
far as
SelectSQL = "SELECT A_Customer_Month_End_View_UK.""Ledger Section""," & _
"A_Customer_Month_End_View_UK.""Account Number""," & _
"A_Customer_Month_End_View_UK.""Customer Name"","
With no Error 13 (but still the ODBC error on the refresh line)

When I added the next line so the code was
SelectSQL = "SELECT A_Customer_Month_End_View_UK.""Ledger Section""," & _
"A_Customer_Month_End_View_UK.""Account Number""," & _
"A_Customer_Month_End_View_UK.""Customer Name""," & _
"A_Customer_Month_End_View_UK.""Credit Limit"","
The Error 13 returned

By the way, I notice the 'From' statement only mentions the Customer month
end view. Do I need to add the open item month end view as well?


"joel" wrote:


Start with a small SQL and then make it larger.You only need a Select
and From.

.CommandText = Array("SELECT *" & vbCrLf & FromSQL)

Get above working first working first. Then add to the SQL little by
litle until ou get the full SQL string.


The SELECT : Are the columns that get returned
The From: The table in the database
The Whe The filtering which returns theonly rows specified
The Groupby : the Sort order of the returned tables.


I assume you are still getting the Error 13. The query doesn't get
process until the Refresh line (last line of the query). If you get an
error in the Refresh line it indicats soemthing is wrong with teh SQL
statements.

The Error message are very vague. Sometimes it is better to use the ADO
method to connect to a database where the error messages have more
detail.

I tired your code yesterday morning and got past the error 13 by
removing the comma. I only used a SELECT and From portion of the SQL.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=198559

http://www.thecodecage.com/forumz

.