ADO hierarchical Recordset via SHAPE APPEND

R

RW

I want to create an ADO hierarchical Recordset via SHAPE APPEND.
This is my code:

Dim rstActions As ADODB.Recordset
strSQL = _
"SHAPE {SELECT * FROM Actions} " & _
"APPEND ({SELECT Description AS Province FROM Province} AS rstProvinces
RELATE FK_Province TO PK_Province) " & _
"APPEND ({SELECT Code AS RegionCode, Description AS Region FROM Regions}
AS rstRegions RELATE FK_Region TO PK_Region) " & _
"APPEND ({SELECT Code AS DepartmentCode, Description AS Department FROM
Departments} AS rstDepartments RELATE FK_Department TO PK_Department " & _
"RELATE FK_Province = " & CStr(FK_Selected_Province)

Set rstActions = New ADODB.Recordset

rstActions.Open strSQL, MyConnection, adOpenStatic, adLockReadOnly, adCmdText

I based myself on the white paper "Using ADO in Microsoft Access 2002" of
Keith Fink and on Articel ID 185425 on ADO Hierarchical Recordsets via SHAPE
APPEND

I get this Error on Execution:

Run-time error '-2147217900 (8004e14)':

Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE',
'SELECT', or 'UPDATE'.

The commandtype enum adCmdText for the Options-parameter in the Open-command
of the recordset evaluates CommandText as a textual definition of a command
or stored procedure call.

I copied the command rstActions.Open strSQL, MyConnection, adOpenStatic,
adLockReadOnly, adCmdText
literlay from the examples given in the texts of Microsoft (except for the
names rstActions, strSQL and MyConnection)

Where do I go wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top