views:

500

answers:

2

I like the subform/subreport control in Access, and I want to put an instantce of the control on my VB6 form.

I reference the msacc.olb in my VB6 project, and put the following codes in my form module.

Private Sub Form_Load()     
Dim aa As Access.SubForm
Set aa = Me.Controls.Add("Access.SubForm", "sf1")
aa.Name = "vvvddvv"
aa.Visible = True
Debug.Print aa.Name, aa.Left

End Sub

I get a Run-time Error '711': Invalid Class String. Looking For Object with ProgId:Access.SubForm.

How can I fix it? Or is there other approach which I can use the Access' SubForm control in a Vb6 form?

A: 

You can't do that - Access objects are not usable outside of MS Access environment.

You can control Access via OLE/COM but that works by starting up MS Access in the background so you can work with the Access objects.

DJ
A: 

It's been a while since I've done this, but I recall having to create a user control in VB6 and then use a repeater control to simulate an Access continuous subform.

Tim Lentine