473,406 Members | 2,549 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,406 software developers and data experts.

Prevent Access DB from being opened twice

I have a frontend and backend database , program.mde and data.mdb on a
client PC.
How do i prevent them launching the program.mde more than once on a
single PC? Somtimes they minizmise the program and dont see it and
startup an new copy.

At a later stage I want this database to be multiuser, on a network ,
so i dont want to limit the database to one user only, just one
program lauch per PC

Can it be done?

TIA

Doug
Nov 13 '05 #1
7 7244
"Douglas" <do********@yahoo.com> schrieb im Newsbeitrag
news:be*************************@posting.google.co m...
I have a frontend and backend database , program.mde and data.mdb on a
client PC.
How do i prevent them launching the program.mde more than once on a
single PC? Somtimes they minizmise the program and dont see it and
startup an new copy.

At a later stage I want this database to be multiuser, on a network ,
so i dont want to limit the database to one user only, just one
program lauch per PC

Can it be done?


Copy the following Code into a module and call the function IsRunning.
(author unknown)

Peter
------------

Function IsRunning() As Integer
On Error GoTo PROC_ERR
Dim DB As DAO.Database
Set db = CurrentDb
If TestDDELink(db.Name) Then
("App alrey opened")
db.Close
Set db = Nothing
DoCmd.Quit
End If
Exit Function

PROC_ERR:
MsgBox "Fehler: " & Error$
Resume Next
End Function

--------------

Function TestDDELink(ByVal strAppName$) As Integer
Dim varDDEChannel
On Error Resume Next
Application.SetOption ("Ignore DDE Requests"), True
varDDEChannel = DDEInitiate("MSAccess", strAppName)
' When the app isn't already running this will error
If Err Then
TestDDELink = False
Else
TestDDELink = True
DDETerminate varDDEChannel
DDETerminateAll
End If
Application.SetOption ("Ignore DDE Requests"), False

End Function

--------------
Nov 13 '05 #2
Douglas wrote:
I have a frontend and backend database , program.mde and data.mdb on a
client PC.
How do i prevent them launching the program.mde more than once on a
single PC? Somtimes they minizmise the program and dont see it and
startup an new copy.

At a later stage I want this database to be multiuser, on a network ,
so i dont want to limit the database to one user only, just one
program lauch per PC

Can it be done?

TIA

Doug


An easy way to do this is to select Tools/Options/Advanced/Exclusive for
the front-end database. (Presumably your users don't open the back end
directly).

This will continue to work if you put the back end on the network, and
install copies of the front end on the local machines. If you intend to
put both front and back end on the network, the IsRunning solution
posted above is the one you want.

Nov 13 '05 #3
On 23 May 2004 02:39:18 -0700, Douglas wrote:
I have a frontend and backend database , program.mde and data.mdb on a
client PC.


In Form_Open of your start-up form:

If Dir(Left$(CurrentDB.Name,Len(CurrentDB.Name) -3) & "ldb") <> "" Then
MsgBox "Application already open"
DoCmd.Quit
End If

The method is fairly reliable because .ldb is always available unless the
mdb has been opened in exclusive mode.

Peter

--
No mails please.
Nov 13 '05 #4
Thanks guys,

I'll need to do it Peter's way as when i say network i actually meant
2 PCs file sharing!
Thanks for your time

Doug

Bruce Dodds <br********@comcast.net> wrote in message news:<tU1sc.99730$xw3.5923495@attbi_s04>...
Douglas wrote:
I have a frontend and backend database , program.mde and data.mdb on a
client PC.
How do i prevent them launching the program.mde more than once on a
single PC? Somtimes they minizmise the program and dont see it and
startup an new copy.

At a later stage I want this database to be multiuser, on a network ,
so i dont want to limit the database to one user only, just one
program lauch per PC

Can it be done?

TIA

Doug


An easy way to do this is to select Tools/Options/Advanced/Exclusive for
the front-end database. (Presumably your users don't open the back end
directly).

This will continue to work if you put the back end on the network, and
install copies of the front end on the local machines. If you intend to
put both front and back end on the network, the IsRunning solution
posted above is the one you want.

Nov 13 '05 #5
Douglas wrote:
Thanks guys,

I'll need to do it Peter's way as when i say network i actually meant
2 PCs file sharing!
Thanks for your time

Doug
Testing for the .ldb file would prevent two users from accessing the
data at the same time.

Bruce Dodds <br********@comcast.net> wrote in message news:<tU1sc.99730$xw3.5923495@attbi_s04>...
Douglas wrote:

I have a frontend and backend database , program.mde and data.mdb on a
client PC.
How do i prevent them launching the program.mde more than once on a
single PC? Somtimes they minizmise the program and dont see it and
startup an new copy.

At a later stage I want this database to be multiuser, on a network ,
so i dont want to limit the database to one user only, just one
program lauch per PC

Can it be done?

TIA

Doug


An easy way to do this is to select Tools/Options/Advanced/Exclusive for
the front-end database. (Presumably your users don't open the back end
directly).

This will continue to work if you put the back end on the network, and
install copies of the front end on the local machines. If you intend to
put both front and back end on the network, the IsRunning solution
posted above is the one you want.


Nov 13 '05 #6
"Peter Doering" <no****@doering.org> schrieb im Newsbeitrag
news:2h************@uni-berlin.de...
On 23 May 2004 02:39:18 -0700, Douglas wrote:
I have a frontend and backend database , program.mde and data.mdb on
a
client PC.


In Form_Open of your start-up form:

If Dir(Left$(CurrentDB.Name,Len(CurrentDB.Name) -3) & "ldb") <> ""
Then
MsgBox "Application already open"
DoCmd.Quit
End If

The method is fairly reliable because .ldb is always available unless
the
mdb has been opened in exclusive mode.


An ldb-file opens only if you access to data or a form is bound to a
recordset. If you have an unbound startform, this method will not work.

Peter
Nov 13 '05 #7
Hi Douglas

"Douglas" <do********@yahoo.com> schrieb im Newsbeitrag
news:be**************************@posting.google.c om...
Thanks guys,

I'll need to do it Peter's way as when i say network i actually meant
2 PCs file sharing!


Be careful:

-This method prevents you from opening the same frontend(!) twice from
the same pc.
-I do not know if it'l work if you open the frontend(!) from a
network-drive (you should stay away from doing this anyway) Maybe it
does-;)
-it does not prevent you from opening the backend(!) more than once.
(explorer etc)
-Opening a database exclusively does not prevent you from opening the
backend twice!

Peter
Nov 13 '05 #8

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

Similar topics

2
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely...
6
by: P. Emigh | last post by:
By default in more recent versions, Access forms keep users' last sort request in the "orderby" property. That can slow things down considerably, especially when the last user has chosen a...
6
by: Divya | last post by:
Hi, I have a web page which generates a CSV file based on some user input. When this file is downloaded by the user, the file is being automatically converted to .xls. Any idea how I can prevent...
16
by: MLH | last post by:
If I give someone a runtime app, they can open the database window by pressing the F-11 key. How to prevent???
3
by: Ben | last post by:
Hello I am in the final stages of developing my asp.net app and have a question. The app im creating has two frames, one being a menu and the other showing the detail. I would like to prevent...
8
by: Shooter4Life8 | last post by:
I am trying to run a macro from my VB.NET program. Here is my code. Dim myAccess As Access.Application Dim allMacro As String = "ALL-Macros" myAccess.DoCmd.RunMacro(allMacro) I get the error....
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: josephkorn | last post by:
Hi all. I have a problem in my website in trying to prevent a user from double submitting the form. I am calling a subroutine from my page_load event that passes in the commandbutton that I want...
2
by: =?Utf-8?B?TkJ1dGNoZXI=?= | last post by:
I am currently sharing my task list on an office server, so that all users can access, add and edit tasks (but not delete). Is there any way of preventing the same task being opened by more than...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.