Actually, this is very simple...
Dim AdoCon As ADODB.Connection
Dim Adorst As ADODB.Recordset
Set AdoCon = New ADODB.Connection
AdoCon.Provider = "MSDataShape"
AdoCon.Open "Data " & sConnectString
Set Adorst = New ADODB.Recordset
Adorst.CursorLocation = adUseClient
SQL = "SHAPE {Select * From [ParentTable]} As Parent " _
& "APPEND ({Select * From [Child Table]} As Child) As Child " _
& "RELATE 'ChildField' TO 'ParentField'"
Adorst.Open SQL, AdoCon, adOpenStatic, adLockBatchOptimistic, adCmdText
Set Adorst.ActiveConnection = Nothing
'Now Set the User Control's Data Source
While Not Adorst.EOF
Set MyCtrl.DataSource = Adorst.Fields("Child").Value
Adorst.MoveNext
Wend
I am not going to list out the properties of the User Control for it to be
DataBound. Too much work =P.
-----Original Message-----
From: maryamka [mailto:maryamka@h...]
Sent: Thursday, July 12, 2001 3:38 PM
To: professional vb
Subject: [pro_vb] Re: User Control Hell Please Help
Hi Stuart, I'm afraid I don't have the answer to your question, but rather
am faced with the same problem which I have been trying to get my head
around for a few weeks now. And I'm afraid I've had no luck. So I was
wondering if you finally got your datarepeater to work with
hierarchical/shape recordsets, because if you have, maybe you can help me
out with the same thing.....
> I am trying to use the datarepeteater which works fine.
> I know have a excellent scrollable menu bar.
> This is for a 32bit app for a retail store.
> The datarepeater repeats a usercontrol which has a image and dept code
and
> department works great.
>
> I want to enhance that to use a shape data base where the child records
> populate a list box.
> This will give me the sub departments under the parent department.
>
> When I look at the field object that contains the child object the child
> records are there. I am slighty confused how to handle this object is it
a
> field or is it a recordset. i know if you do a set rs = field
(child).value
> you then return the recordset.
>
> But the data repeater returns the field object containing the whole
child
> object and I can't work out how to create the databinding in the user
> control so that it will populate a listbox.
>
> The active x contol interface wizard just seems to make a pigs ass of
> automatically creating the link.
>
> I have tried creating a object but that really sends vb laa laa.
>
> Any one any ideas as I have been at this one for a while source code
would
> be lovely but anything will do.
>
> If you think you can be of help please reply
>
> Thanks
> Stuart