By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,045 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,045 IT Pros & Developers. It's quick & easy.

Creating objects at runtime using NEW

P: n/a
I am issuing the following commands in a form's detail on click event.
Private Sub Detail_Click()
Dim Nline As Line
Set Nline = New Line

I get :"ActiveX component can't create object"

According to MS Help this means the <"Line"?> class is not registered
in the registry.

Is my problem that MS Access thinks this is an ActiveX class? If so
how do I fix?

Regards...
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
TC
If you want to create a new line control on an Access form, through VBA, at
runtime, you must open the form in design view (using OpenForm), from some
**other** form, then use the CreateControl method.

Alternatively, perhaps just "pre create" some unused Line controls manually,
& set their Visible properties False so they are not visible. Then code
within your form could reposition them & make them visible - no need for
CreateControl.

The New keyword will definitely not do what you want.

HTH,
TC
"Casper" <al***@xtra.co.nz> wrote in message
news:1a**************************@posting.google.c om...
I am issuing the following commands in a form's detail on click event.
Private Sub Detail_Click()
Dim Nline As Line
Set Nline = New Line

I get :"ActiveX component can't create object"

According to MS Help this means the <"Line"?> class is not registered
in the registry.

Is my problem that MS Access thinks this is an ActiveX class? If so
how do I fix?

Regards...

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.