Solved

VB.NET and Access VBA code

Posted on 2014-01-20
5
654 Views
Last Modified: 2014-01-29
I've found code that should make it possible to run a macro inside an access database from VB.NET.

Dim Adb As New Access.Application
Adb.OpenCurrentDatabase("Path To the database")
Adb.Run("procedure name to be ran..")
Adb.CloseCurrentDatabase()
Adb.Quit()

Open in new window


Is it possible to trigger an event that would make it evident that the macro has finished running?

I looked here http://msdn.microsoft.com/en-us/library/office/ee291795(v=office.12).aspx but didn't see anything that looked like it would work.

I don't want the user to continue until the process has finished.

Thanks for your help!
0
Comment
Question by:slightlyoff
[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
5 Comments
 
LVL 36

Accepted Solution

by:
PatHartman earned 500 total points
ID: 39795041
I would create a wrapper function that calls the function you are trying to run.  The wrapper could post a status in a table and you could read that.
0
 
LVL 1

Author Comment

by:slightlyoff
ID: 39795470
Thanks for your reply! I left the office, but will give that a try tomorrow.
0
 
LVL 40
ID: 39795558
This would have to be checked, I am not at my computer right now.

You could close the database in the macro.

See if there is a way to detect that closure from your application, maybe by checking a property of Adb.CurrentDB.
0
 
LVL 84
ID: 39795836
What is "the process"? Wondering if it could be ported over to .NET instead ...
0
 
LVL 1

Author Comment

by:slightlyoff
ID: 39818743
Sorry for the long delay in updating this question.
I think the updating of a status works the best - so I built that into the database - a simple table with a 1 or 0 depending on if it's being updated.

unfortunately, running the macro from a users computer doesn't seem to work.
It wants to open access on my computer when I run the code.

Since my next question isn't quite the same as this initial question, I'm going to open a new question.  Thanks for your help!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 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