Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Defining a reference to Microsoft Agent on a form

Posted on 2004-11-01
8
Medium Priority
?
276 Views
Last Modified: 2008-03-03
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".
0
Comment
Question by:leeskelton83
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
8 Comments
 
LVL 16

Expert Comment

by:jimbobmcgee
ID: 12464272
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
 
LVL 3

Author Comment

by:leeskelton83
ID: 12464319
No I can use Me.ActiveXCtl0 too and get the same thing.
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 12465355
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
 
LVL 3

Author Comment

by:leeskelton83
ID: 12465606
What does is charID = "MyCharacterName"?
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12818215
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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question