Article ID: 185425
Article Last Modified on 3/14/2005
SHAPE {parent-command} [[AS] name]
APPEND ({child-command} [[AS] name] RELATE parent-field TO child-field)
[,({child2-command} ...)]
Note
Private Sub Command1_Click()
Dim cn As ADODB.Connection, rsPub As ADODB.Recordset, _
rsTitle As ADODB.Recordset, SQL As String
Set cn = New ADODB.Connection
Set rsPub = New ADODB.Recordset
cn.Provider = "MSDataShape"
cn.Open "dsn=Pubs;uid=<username>;pwd=<strong password>;database=pubs"
SQL = "SHAPE {SELECT * FROM publishers} APPEND " & _
"({SELECT * FROM titles} AS PubTitles " & _
"RELATE pub_id TO pub_id)"
rsPub.Open SQL, cn, adOpenStatic, adLockReadOnly, adCmdText
Do While Not rsPub.EOF
Debug.Print "Publisher", rsPub!pub_name
Set rsTitle = rsPub!PubTitles.Value
Do While Not rsTitle.EOF
Debug.Print , rsTitle!Title
rsTitle.MoveNext
Loop
rsTitle.Close
rsPub.MoveNext
Loop
rsPub.Close
cn.Close
Set rsTitle = Nothing
Set rsPub = Nothing
Set cn = Nothing
End Sub
189657 HOWTO: Use the ADO SHAPE Command
Additional query words: OffCon epucon
Keywords: kbinfo kbdatabase KB185425