Using an ActiveX component dynamically

  • Thread starter Thread starter Shiva
  • Start date Start date
S

Shiva

Hi,

I've downloaded and registered the ActiveX component uFREEDB in Access 2002.
The list of ActiveX components being installed displays the component
FREEDBControl.uFREEDB so it has been registered properly.

I want to create this component dynamically using some VBA. I tried this but
it doesn't work:

Dim uFREEDB1 As uFREEDB
Set uFREEDB1 = New FREEDBControl.uFREEDB

The Set-command cannot be compiled, the error "Invalid use of New keyword"
is displayed. I'm not sure if I have to use the set command anyway, but
just the Dim-command is insufficient.

So how do I fix this?

Thanks in advance!
 
Hi Shiva,

I've never used the uFREEDB controlm but not all objects are compatible
with the New operator. Try
Set uFREEDB1 = CreateObject(FREEDBControl.uFREEDB)
instead.
 
Thanks a lot John, this did the trick!

John Nurick said:
Hi Shiva,

I've never used the uFREEDB controlm but not all objects are compatible
with the New operator. Try
Set uFREEDB1 = CreateObject(FREEDBControl.uFREEDB)
instead.
 
Back
Top