Solved

Triggering an Access macro from within a Visual Basic - exe

Posted on 2001-06-14
3
179 Views
Last Modified: 2013-11-25


I have the following situation :
An Access database residing on a server.
The same Visual Basic Exe is installed on several client PC's , the exe reading the data from the Access database.
Now i want to make a button on my VB-exe form to launch a macro , defined in the Access Database.
I tried it using the Shell command , but since i don't have Access installed on the client PC's ( only on the server ) , it gives an error.

Is there a way to do it using OLE-automation ? The Database object doesn't contain a method to launch macro's , only to execute Queries.
0
Comment
Question by:Steamer
[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
3 Comments
 
LVL 4

Expert Comment

by:RichW
ID: 6192878
Try this:  Set a reference to the Microsoft Access 8.0 Object Library.


Public Sub RunMacro()

Dim acApp As Access.Application
Dim strDBPath As String

   Const DB_PATH As String = "C:\Db1.mdb"
   Set acApp = New Access.Application
   With acApp
      .OpenCurrentDatabase DB_PATH
      .DoCmd.runmacro "Macro1", 1, 1
   End With
   acApp.Quit
   Set acApp = Nothing

End Sub
0
 

Author Comment

by:Steamer
ID: 6200077
Tried the above mentioned code , but i still got the error :

Microsoft Access : ActiveX component can't create object.

This is still because access isn't installed on the computer where the VB application is running.
for a test i installed access and the application is running fine.
Due to the licensing , i really need a solution which would be able to work without installing Access since the application runs on several computers.
Any options to bypass this ?
0
 
LVL 4

Accepted Solution

by:
RichW earned 100 total points
ID: 6202085
Try compiling the application, and running a setup package.  VB should grab the files needed from the Access library and add them to the setup package CAB file.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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