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!

Hi, I have this code. At Rs.open

Status
Not open for further replies.

simran1

Programmer
Apr 23, 2002
82
US
Hi,

I have this code. At Rs.open stmt i get the error saying
"Runtime - error
Invalid SQL statement; expected 'Insert', 'delete', 'pprocedure', 'select' or 'update' "


Code:
Dim RS As New ADODB.Recordset
Dim sql As String

RS.CursorLocation = adUseClient

sql = "SHAPE {SELECT * FROM RSStrnoCnt}  AS 
sql = sql & " DailySales APPEND "
sql = sql & " (( SHAPE {SELECT * FROM ReportSales}
sql = sql & " AS DSReport APPEND 
sql = sql & " ({SELECT * FROM ReportSubTotals} "
sql = sql & " AS RSSubTotals RELATE Date TO Date) 
sql = sql & " AS RSSubTotals) AS DSReport "
sql = sql & " RELATE Date TO  Date) AS DSReport "

RS.Open sql, DSN, adOpenDynamic, adLockOptimistic

Set DrDailyStoreSales.DataSource = RS

What does the error mean, and what do i need to do?
I appreciate time taken to help me.

 
Well,

My first question to you is do you have the appropriate Connection object instantiated? It should look like the following:

Set oConn_Shape = New ADODB.Connection
oConn_Shape.ConnectionString = "Provider=MSDataShape.1;Persist Security Info=False;Data Source=YourSourceDB;Data Provider=MICROSOFT.JET.OLEDB.4.0"

If you aren't using this connection string, then you will not be able to "shape" your data. See if that doesn't fix your problem.

Elysium
 
Hi,
Yes i have my connection well instantiated.
I am able to open other types of queries, like select or any type of joins. I have problem only with this query.

 
hi,
thanx Elysium.
I had reset my connection string as you said. Thank you for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top