Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ActiveX - VB6 - Access97

25 views
Skip to first unread message

Stephen Lebans

unread,
Jun 18, 1999, 3:00:00 AM6/18/99
to
VB6 Win95 Access97

ActiveX control will not copy by using GUI to Copy then Paste in
Form/Report Design View.
Run Time Error 398 Client Site Not Available .. if you click OK you then
get Unexpected Error (40040).

The control was developed in VB6. It is a very simple label control with
a couple of API calls and 1 Print statement.

This is the last bug to get ironed out. If anyone could point me in the
right direction I would very much appreciate it.

Stephen Lebans
maca...@nbnet.nb.ca
http://www.geocities.com/~slebans/

Pete B

unread,
Jun 19, 1999, 3:00:00 AM6/19/99
to
In the first place, that is not how you place an ActiveX control on a form.
Been awhile (I hardly ever use anything but native Access controls), not
sure about A97, but in Access 2000, you open the form in design view, then
select Insert/ActiveX Control.... from the menu, then find the target
control from the dialog. As I recall it is similar in A97.

Second, not all ActiveX controls can be hosted by Access. If you have not
properly designed the control, Access will not use it, or else may use it
with strange results. However, all else being equal, what you describe
should not be a problem.

Make sure your vb control is registered with VBA, too, ie you can see a
Reference to it in the References dialog. Here again, if it was designed on
the same PC as the Access app, you will probably alreasdy have that set.

--
Pete B
Stephen Lebans <macarth...@nbnet.nb.ca> wrote in message
news:7keqc8$fco$1...@garnet.nbnet.nb.ca...

Stephen Lebans

unread,
Jun 19, 1999, 3:00:00 AM6/19/99
to
Hi Pete,
I guess I didn't explain myself properly. I designed this control in
VB6. It's a simple Text Rotation control based on the TiltLabel control
from Rod Stephens' book. I added some features to allow the control to
be bound to a field, some Access specific logic, and some font/printing
resolution stuff.

MSDN suggests several tests to make sure your control is stable. The
only one I'm having trouble with is when the user uses the GUI to try
and Copy and Paste an existing/sited control. The Copy/Paste operation
fails with the RunTime 398 Error, Client Site Not Available.

I can't find very much documentation/examples of this error. It seems to
be a general catch-all error. From DejaNews it seems it might be caused
by an improper reference to an Extender or Ambient property in the
controls Initialize or InitProperties procedures.
Damn, I just noticed I don't have an Initialize procedure only
InitProperties...better go put one in and see what happens!

Pete B wrote in message <7kg7j6$grb$1...@usenet46.supernews.com>...


>In the first place, that is not how you place an ActiveX control on a
form.

SNIP


Stefan Kühnen

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
Stephen Lebans wrote in Message <7kgd4n$ic7$1...@garnet.nbnet.nb.ca>...

>Hi Pete,
>I guess I didn't explain myself properly. I designed this control in
>VB6. It's a simple Text Rotation control based on the TiltLabel control
>from Rod Stephens' book. I added some features to allow the control to
>be bound to a field, some Access specific logic, and some font/printing
>resolution stuff.
>
[...]

Hi Stephen,
is your problem fixed?
I have to write a control for Access97. Could you please point me some
directions where to look for information on binding the VB6 Control to a
field and other Access specific logic. Is the book from Rod Stephens you
mention a good source and where can i get it?

Stefan Kühnen

Stephen Lebans

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
Hey Stefan,
I'm sad to say it took me hours to figure out how to bind an ActiveX
control property to a field in Access. I was trying to make it way too
complicated. I simply could not find any Access specific examples
anywhere I looked.

Anyhow, leave all of the data specific properties in your controls
property sheet set to none. Let's use the Caption property for an
example.
In the Project Group window double click on your controls name. It
should turn Highlighted, then greyed out. Now go to Tools->Procedure
Attributes. In the NAME field select Caption. Click on the advanced
button. Now under Data Binding and select both:
1) Property is Data Bound
2)This property binds to data field.

That's it! Now when you load your control in Access, there is a normal
ControlSource property under the Data tab for your control. Your Caption
property will contain the current record's value as you page through the
recordset. It's just like a regular TextBox in that you can specify a
calculated expression as the recordsource.

There are a few Access specific things that come to mind. Don't use
Ambient.Forecolor. This is not a valid property at the Form level, and I
think it's causing my Runtime error on Copy and Paste.
In a header, a control will require a Me.Refresh on the On Updated event
for the control. Bunch of other minor details..but if I told you
everything I'd bore you to death! :-)

I'm finding a lot of subtle differences in the VB vs VBA environments at
runtime for the control. I plan on compiling the lessons learned form my
ActiveX Access journey and will post them to my Web page over the next
few weeks.

Finally, definately buy Rod Stephens' "Custom Control Library" book.
It's an excellent book full of ready to run ActiveX controls with full
source. I also really like Appleman's "Developing ActiveX Controls with
VB5". It explains the nuts and bolts of ActiveX.

I've posted the intial, Version1 of my control to my Web page. I spent
last night improving the property sheets, cleaning up the code, and
adding a few more features. I should have a newer release ready for this
weekend.


HTH

--

Stefan Kühnen wrote in message ...

Stephen Lebans

unread,
Jun 21, 1999, 3:00:00 AM6/21/99
to
I found the problem. For any lurkers out there following this thread the
problem lay in the UserControl Font property.
VB Help states that "If you want to allow the end user of your control
to select a font at run time, the standard Font property won't work".
Well that's not quite true as I was using the standard Font property in
just that fashion. Everything worked great EXCEPT for the runtime error
on the GUI Cut & Paste operation.

VB HELP File Topic "Adding a Font Object to Your User Control" gives a
step by step tutorial how to rectify the problem. Works Great!

Stephen Lebans >MSDN suggests several tests to make sure your control is

0 new messages