Solved

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

Posted on 2008-06-16
5
275 Views
Last Modified: 2013-11-26
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




0
Comment
Question by:Eric Sherman
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:Christopher Kile
Comment Utility
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).
0
 
LVL 19

Author Comment

by:Eric Sherman
Comment Utility
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

0
 
LVL 19

Author Comment

by:Eric Sherman
Comment Utility
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





0
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 500 total points
Comment Utility
1.  Here's the beauty of .NET and VB.NET:  In order to build a COM DLL using Visual Studio, you simply build a .NET DLL, add classes to it, then specify that each object, and the project itself, are assigned a GUID.  I don't know whether you've worked with objects and classes in VB prior to .NET, but Visual Basic 6.0 (which is 100% dialect-compatible with the Visual Basic for Applications that you are running in A2K supported construction of single-layer classes (no inheritance).    http://msdn.microsoft.com/en-us/library/x66s8zcd(VS.71).aspx links to a walkthrough of how to use VB in VS.NET to create COM objects.

2.  You write a method for that COM object that will be publicly exposed for use that will do the work by reading the properties of the object, formatting the message, then sending the message using .NET APIs.  You can call that method PostMessage().  A method is just an object-based name for a subroutine or function that is defined within the object (just like a subroutine or function is defined in a module).  

0
 
LVL 19

Author Comment

by:Eric Sherman
Comment Utility
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
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now