I should have been clearer.
Below is the code I have already. This will open the form, in a new instance
of access.
The reason I want to check for existing Access, is to stop the same db being
opened multiple times.
Dim oAccess As Access.Application
Dim oForm As Access.Form
Dim stCriteria As String
Dim sForm As String 'name of form to show
' Start a new instance of Access for automation:
oAccess = New Access.ApplicationClass()
' Make sure Access is visible:
If Not oAccess.Visible Then oAccess.Visible = True
oAccess.OpenCurrentDatabase(filepath:=Sales_Path, Exclusive:=False)
sForm = "frmSales"
oAccess.DoCmd.OpenForm(sForm, Access.AcFormView.acNormal)
I'm guessing you want to do one of two things, first you might mean
you want to open the file using Process.Start(...). If so, then I
don't know of a good way of seeing if it's already open, and I don't
think it matters. If the user wants multiple instances and Access will
let them, then you should too (in other words, it's not your problem).
If however you are opening Access as part of an automation task
through Process.Start(...), don't.
Secondly, if you are trying to interact with Access as part of an
automation routine, you should be doing so through ADO.NET. Doing this
will fix the problem of Access being opened and not closed, as ADO.NET
will not start Access. If you don't know how to do this, some
searching on Google should turn up some step-by-step instructions.
Thanks,
Seth Rowe [MVP]
http://sethrowe.blogspot.com/