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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ryan ChongConnect With a Mentor Commented:
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
 
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
 
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
All Courses

From novice to tech pro — start learning today.