Defining a reference to Microsoft Agent on a form

How do I define a reference to a Microsoft Agent on an Access form ? After putting the control on a form and trying this:
Dim myagent As Agent
 Set myagent = Forms!Form1!ActiveXctl0

I get "Type Mismatch".
LVL 3
leeskelton83Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jimbobmcgeeCommented:
This syntax is wrong:

     Set myagent = Forms!Form1!ActiveXctl0

If you are setting something, it must always be to an object.  In the VBA window, use the object browser (F2) to work out what these objects are.  

I imagine the line should look something like this:

     Set myagent = myApp.Forms("Form1").ActiveXctl0

HTH

J.
0
leeskelton83Author Commented:
No I can use Me.ActiveXCtl0 too and get the same thing.
0
Ryan ChongCommented:
Try add the M$ Agent Control x.x Library from Reference, with an Agent placed on your form, then try:

...
Dim Character As IAgentCtlCharacterEx

charID = "MyCharacterName"
charRunPath = "C:\windows\msagent\chars\myCharacter.acs"

MyAgent.Characters.Load charID, charRunPath
   
    Set Character = MyAgent.Characters(charID)
...

For more info, try see:
http://www.microsoft.com/msagent/
http://www.msagentring.org/
http://www.agentry.net

Hope this helps
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
leeskelton83Author Commented:
What does is charID = "MyCharacterName"?
0
Ryan ChongCommented:
sorry, as not response on this thread...

>>What does is charID = "MyCharacterName"?
Actually you can put whatever as you like.. in this line:

MyAgent.Characters.Load charID, charRunPath

what important will be the charRunPath, which indicates the location of the .acs (the character file) file to be loaded later.


Will you still need help here, leeskelton83  ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.