Question : How do I stop my accdr from running twice on the same computer

Hi Experts All,

I have an accdr that is deployed to a number of machines.  The accdr connects to a .mdb on a network share.  All is well except when the user opens two or more instances then strange things start to happen so I would like to prevent it.  I have been here:
http://www.groupacg.com/ACodeTip.htm#DDE
and here:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_20101662.html?sfQueryTermInfo=1+access+instanc+open+prevent+second+user
and here:
http://www.mvps.org/access/api/api0041.htm

In both caes ie. using the DDE method or Graham Mandeno's Window titlebarcheck have no effect!  Am I missing something ?  Should I be explicitly typing my applications title somewhere in this code to make it work?

I am using win7 and access 2007 to develop and winxpsp3 with 2007 runtime on my deployed machines.

Pulling my hair out so hope you can get me back on track.

Cheers
Clay258

Answer : How do I stop my accdr from running twice on the same computer

BTW, here's the routines out of my AppInfo Module, which includes AppName just to give you an idea of what that looks like.

Note that I am unable to post the code for GetCurrentDBName_TSB() in AppShortName because it is used under license (but it's a simple routine which I can tell you how to write if you really want to know).

HTH,
JimD.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
'------------------------------------------------------------------------
' MODULE:   ApplicationInfo
'
' PURPOSE:  Application info and security for this application.
'------------------------------------------------------------------------
Option Compare Database
Option Explicit
 
Const ModuleName = "Application Info"
 
Private gstrAppShortName As String
Private gstrAppReleaseDate As String
Private gstrAppVersion As String
 
Function AppName() As String
 
10      AppName = "Base Code"
 
End Function
Function AppShortName() As String
 
        ' Returns the database name with no extenstion.
        Dim strDatabaseName As String
 
10      If Nz(gstrAppShortName, "") = "" Then
20        strDatabaseName = GetCurrentDBName_TSB()
30        gstrAppShortName = UCase(left$(strDatabaseName, InStr(1, strDatabaseName, ".") - 1))
40      End If
 
50      AppShortName = gstrAppShortName
 
End Function
Function AppRegistrationInfo() As String
 
10      AppRegistrationInfo = "XYZ, Inc."
 
End Function
 
Function AppReleaseDate() As String
 
10      If Nz(gstrAppReleaseDate, "") = "" Then
20        gstrAppReleaseDate = DMax("[ReleaseDate]", "tblAppVersionControl")
30      End If
        
40      AppReleaseDate = gstrAppReleaseDate
 
End Function
 
Function AppSerialNumber() As String
 
10      AppSerialNumber = "1"
 
End Function
 
Function AppVersion() As String
 
10      If Nz(gstrAppVersion, "") = "" Then
20        gstrAppVersion = DMax("[Version]", "tblAppVersionControl")
30      End If
        
40      AppVersion = gstrAppVersion
        
End Function
 
Function CheckVersion()
 
        Dim pb As New Form_frmProgBar
        Dim sngNetVersion As Single
        Dim sngLocalVersion As Single
        Dim strMsgText As String
        Dim strCrLf As String
 
10      pb.SetMessage "Checking for new version..."
20      pb.SetBarVisible False
 
30      sngNetVersion = DMax("[Version]", "tblAppVersionControlNet")
40      sngLocalVersion = AppVersion()
 
50      Set pb = Nothing
 
60      If sngLocalVersion < sngNetVersion Then
70        strCrLf = Chr$(13) & Chr(10)
80        strMsgText = "You do not have the most recent version of this application.  Please update the application." & strCrLf & strCrLf
90        strMsgText = strMsgText & "The following changes have occured:" & strCrLf & strCrLf
100       strMsgText = strMsgText & "    " & DLookup("[UserComment]", "tblAppVersionControlNet", "[Version] = " & sngNetVersion)
110       MsgBox strMsgText
120       Call ApplicationExit
130     End If
 
End Function
Random Solutions  
 
programming4us programming4us