Link to home
Create AccountLog in
Avatar of Eric Sherman
Eric ShermanFlag for United States of America

asked on

How to get Access 2k VB Function to work with VB.Net???

I have a front/end Access 2k Disptaching application connected to a MySQL back end server for a client.  Currently we have a xmlgateway vehicle tracking service for which inbound transactions are posted directly to the MySQL server tables and this all works and was developed by a web developer.  Now, on the click of a button, I have to make the Access 2k front/end application send a basic text message to a vehicle through the xmlgateway.  I have the format and structure of the SendOutboundMessage Function provided by the tracking company and it uses VB.Net which is what I'm trying to get a clear understanding on how to make this work since the application is written in Access/VBA.

1.) Obviously I will need a copy of VB.Net to write this function and the question is since the application is Access/VBA, will the entire application have to be converted to VB.Net or can the application use both as long as they both exist on the machine???

2.) Also, at the client site, this appliation is used on several machines and they already have VB.Net on there web server because they can process the InBound transactions.  If I include this function in the Access Front End, will all machines have to have VB.Net installed on them???

Thanks,

ET




Avatar of Christopher Kile
Christopher Kile
Flag of United States of America image

1.  Access 2k can use ActiveX objects (COM).  You can build such objects in VB.NET.  Build an object to send the message, and accept the message as an argument from Access2K.  Link it in to Access 2k as you would any other COM reference.  Build your button code in Access to intialize the COM object then call the message-sending method.  You have some learning to do here, but if you take this path you won't have to rewrite the Access2k app.

2.  You don't need VB.NET, which is just the development environment for that language, but the proper version of .NET should be installed on each of your client's machines.  Happily, that is usually part of the standard Windows Update process, and thus should cause little or no problem at your client's site.  Talk to your client's IT maintenance people and find out whether they've been installing and updating .NET and what versions they have out there (if they're only deploying .NET version 2.0 and above, you'll need Visual Studio 2005 or later).
Avatar of Eric Sherman

ASKER

Ok, thanks cpkilekofp for the quick reply ...

I think I get the general idea and it will probably be more clear once I get into it.  

Can you explain a bit further the following comments ...

"Build an object to send the message, and accept the message as an argument from Access2K"

"Build your button code in Access to intialize the COM object then call the message-sending method."

I am familiar with COM objects and referencing them in Access but I'm just trying to make sure I understand your approach.

Thanks,

ET

Ok, I guess it would be nice if the tracking company had a API in the form of an ActiveX COM object.  I've used those before for faxing.  Creating that COM object is the confusing part right now but the actual XML code to send the text message is not really that long (account, user, pswd, messagetype, vehicle, messagedata), so I should be able to create it.   I am comparing this to the efax COM object that I currently use.  

For example with efax I would do the following from within a Access VBA module ...

'Instantiate the Main object
Dim api As eFaxDeveloper.IOutboundClient
Set api = New eFaxDeveloper.OutboundClient

'Instantiate a DocumentBundler object
Dim docs As eFaxDeveloper.IDocumentBundler
Set docs = New eFaxDeveloper.DocumentBundler

'Set your eFax Developer account identifier (required)
api.SetAccountID ("xxxxxxxxxx")

'Set your eFax Developer user name (required)
api.SetUserName ("xxxxxxx")

'Set your eFax Developer password (required)
api.SetPassword ("xxxxxxx")

'Set the recipient name for this transmission (optional)
api.SetRecipientName ("xxxxx")

'Set the recipient company name for this transmission (optional)
api.SetRecipientCompany ("Widgets R Us")

'Set the recipient fax number for this transmission (required)
api.SetRecipientFax ("xxxxxxxxxx")

'Add document(s) to the DocumentBundler object
docs.Add (DocumentToSend)
api.SetDocuments docs
       
'Perform the Post to eFax Developer
api.PostRequest


Here's what I am trying to figure out according to your first comments.

1.) How to create the COM object that would accept the AccountID, Username, Password, MessageType, VehicleName, MessageData???

2.) Then, how would you tell it to Post as shown above with the efax COM object???


Thanks,

ET





ASKER CERTIFIED SOLUTION
Avatar of Christopher Kile
Christopher Kile
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thanks cpkilekofp ... Your comments have pointed me in the right direction.  I have been playing around with Visual Basic 2008 Express edition and have realized that the full version will be need to accomplish what I'm trying to do.  The Express is designed for beginners and creating COM objects would not be considered something beginners would be involved in so most of the features are not included.

Much Appreciated ...

ET