473,395 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Automate MSAccess from Windows .Net app

From a windows .Net app, I need to 1) check if MSAccess is already open to a
certain Access application. If so, then open a form and find a certain
record. 2) If not open, then open MSAccess and open a secured Access
application and then open a form and find a record. (The Access App is
secured not with a database password but with full user name and password
security.)

I can open the form and find the record OK. I am having problems checking if
the app is already open and opening the secured app.

Using "GetObject" has the problem of finding other instances of MSAccess but
not the database application I am interested in.

I used to use API calls to see if a window was already open with the name of
the MSAccess app but I can't get the API calls to work in .Net

I really would rather not use the shell() function since it has some
problems but I can't see any other way to automate a secured Access
Application.

Any ideas?
--
Brad Burke
FusionData, LLC
970 222-1501
Nov 22 '05 #1
3 2260
First of all, if possible, I'd avoid automate Access app: now that you are
writeing a stand-alone app, you can easily access data in that *.mdb file
amd manipulate the data (add/update/delete), why build an app, have the new
app start an existing app to process data. Maybe, you do not want to
re-write a fairly complicated process in that Access app. Anyway, if you
have do things this way, a solution I can think of, is to make sure that
Access app is only front-end app, the data part should be splitted as back
end. This way, your .NET app does not need to care if the Access front end
app is newly created instance or existing instance, or whether there are
multiple that Access app instances running, because all these app(s) work
toward the same data in the back-end and there is only one record in the
back end you need to find.
"Brad Burke" <Br*******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
From a windows .Net app, I need to 1) check if MSAccess is already open to a certain Access application. If so, then open a form and find a certain
record. 2) If not open, then open MSAccess and open a secured Access
application and then open a form and find a record. (The Access App is
secured not with a database password but with full user name and password
security.)

I can open the form and find the record OK. I am having problems checking if the app is already open and opening the secured app.

Using "GetObject" has the problem of finding other instances of MSAccess but not the database application I am interested in.

I used to use API calls to see if a window was already open with the name of the MSAccess app but I can't get the API calls to work in .Net

I really would rather not use the shell() function since it has some
problems but I can't see any other way to automate a secured Access
Application.

Any ideas?
--
Brad Burke
FusionData, LLC
970 222-1501

Nov 22 '05 #2
Norman,
Thanks for your reply. You make some good points. The best idea you gave me
was to just open another instance of the access application and not worry if
one already exists. The apps are split into front end / back end so that
should work fine. Great idea.

This is a mapping application that shows seven different utilities.
(Electric, water, sewer, stormwater, fiber and traffic.) Each utility has its
own inventory and maintenance database so it would take me years to duplicate
all of the functionality into my mapping front end.

So, I am back to opening a secured Access application from .Net I don't
think I can use:

Dim oAccess As Access.Application
' Start a new instance of Access for Automation:
oAccess = New Access.ApplicationClass()
' Open a database in exclusive mode:
oAccess.OpenCurrentDatabase(filepath:="c:\mydb.mdb ", Exclusive:=True)

Since this won't open a secured application.

Will I have to use something like:

x = Shell(application & " " & Chr(34) & dbs & Chr(34) & " /nostartup
/user " & user & _
" /pwd " & password & " /wrkgrp " & Chr(34) & workgroup & Chr(34),
vbMinimizedFocus)

On Error GoTo WAITFORACCESS
Set accObj = GetObject(, "Access.Application")

Are these my only choices?

Thanks much!


"Norman Yuan" wrote:
First of all, if possible, I'd avoid automate Access app: now that you are
writeing a stand-alone app, you can easily access data in that *.mdb file
amd manipulate the data (add/update/delete), why build an app, have the new
app start an existing app to process data. Maybe, you do not want to
re-write a fairly complicated process in that Access app. Anyway, if you
have do things this way, a solution I can think of, is to make sure that
Access app is only front-end app, the data part should be splitted as back
end. This way, your .NET app does not need to care if the Access front end
app is newly created instance or existing instance, or whether there are
multiple that Access app instances running, because all these app(s) work
toward the same data in the back-end and there is only one record in the
back end you need to find.
"Brad Burke" <Br*******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
From a windows .Net app, I need to 1) check if MSAccess is already open to

a
certain Access application. If so, then open a form and find a certain
record. 2) If not open, then open MSAccess and open a secured Access
application and then open a form and find a record. (The Access App is
secured not with a database password but with full user name and password
security.)

I can open the form and find the record OK. I am having problems checking

if
the app is already open and opening the secured app.

Using "GetObject" has the problem of finding other instances of MSAccess

but
not the database application I am interested in.

I used to use API calls to see if a window was already open with the name

of
the MSAccess app but I can't get the API calls to work in .Net

I really would rather not use the shell() function since it has some
problems but I can't see any other way to automate a secured Access
Application.

Any ideas?
--
Brad Burke
FusionData, LLC
970 222-1501


Nov 22 '05 #3
On Thu, 21 Apr 2005 16:05:02 -0700, "Brad Burke" <Br*******@discussions.microsoft.com> wrote:

¤ Norman,
¤ Thanks for your reply. You make some good points. The best idea you gave me
¤ was to just open another instance of the access application and not worry if
¤ one already exists. The apps are split into front end / back end so that
¤ should work fine. Great idea.
¤
¤ This is a mapping application that shows seven different utilities.
¤ (Electric, water, sewer, stormwater, fiber and traffic.) Each utility has its
¤ own inventory and maintenance database so it would take me years to duplicate
¤ all of the functionality into my mapping front end.
¤
¤ So, I am back to opening a secured Access application from .Net I don't
¤ think I can use:
¤
¤ Dim oAccess As Access.Application
¤ ' Start a new instance of Access for Automation:
¤ oAccess = New Access.ApplicationClass()
¤ ' Open a database in exclusive mode:
¤ oAccess.OpenCurrentDatabase(filepath:="c:\mydb.mdb ", Exclusive:=True)
¤
¤ Since this won't open a secured application.
¤
¤ Will I have to use something like:
¤
¤ x = Shell(application & " " & Chr(34) & dbs & Chr(34) & " /nostartup
¤ /user " & user & _
¤ " /pwd " & password & " /wrkgrp " & Chr(34) & workgroup & Chr(34),
¤ vbMinimizedFocus)
¤
¤ On Error GoTo WAITFORACCESS
¤ Set accObj = GetObject(, "Access.Application")
¤
¤ Are these my only choices?

If you're implementing user-level security I'm afraid there isn't really another option when using
automation.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Brad Burke | last post by:
From a windows .Net app, I need to 1) check if MSAccess is already open to a certain Access application. If so, then open a form and find a certain record. 2) If not open, then open MSAccess and...
15
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to...
2
by: Chris | last post by:
I recieve unrecognized database format when trying to open a MSAccess 2003 database with MSAccess 2000. I only need it to open as read-only. Why won't it open my database?
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
25
by: MLH | last post by:
In an earlier post entitled... "A97 closes down each time I open a particular report" it has been suggested that I rebuild problematic table - one in which some corruption has occurred. I...
0
by: Richard Beacroft | last post by:
Trying to write a C# Windows App to export all objects and content from 2 MSAccess 97 databases for comparison analysis. very little documentation found. Have managed to instantiate MSAccess,...
4
by: Annick Van Hoof | last post by:
Hi, I'm having my ASP.NET application hosted at a Windows 2003 server (IIS6). This works almost all the time (I have uptimes of 100% on most days), but then all of a sudden a few days in a row I...
3
by: BobAchgill | last post by:
I am trying to read in a xml file that I exported from my MSAccess table using the following lines of code but it bombs. Is this the right code? Is there a way to get a clean export from Access...
11
by: Yelena Varshal via AccessMonster.com | last post by:
Hello, I have a problem with one of msaccess.exe API calls that work on my desctop but does not work on the laptop from within MS ACCESS. There is a lot of differences between 2 computers...
11
by: gert365 | last post by:
I'm working on a scirpt to be used on a windows machine and I need to automate a user's input on the command prompt. For example I'm using os.system('mycommand') to excute the commands I want. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.