Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 687
  • Last Modified:

VB.NET and Access VBA code

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
slightlyoff
Asked:
slightlyoff
1 Solution
 
PatHartmanCommented:
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
 
slightlyoffAuthor Commented:
Thanks for your reply! I left the office, but will give that a try tomorrow.
0
 
Jacques Bourgeois (James Burger)Commented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
What is "the process"? Wondering if it could be ported over to .NET instead ...
0
 
slightlyoffAuthor Commented:
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

New feature and membership benefit!

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

Tackle projects and never again get stuck behind a technical roadblock.
Join Now