Oct 8 2009, 04:40 PM
I have searched through the archives and apologize if I missed it, but couldn't find the answer to my question.
I have developed a db which is split and has Multi-User / Level security set up. The users access the db from one of any 5 machines. The idea is that they log off current user (the db user not computer user) and log on as themselves when taking over that station. However, they have been minimizing the previous instance of Access and opening another for themselves. This bypasses security to an extent because they could easily create records as the other user logged on in the other instance.
My question is, how can I run VBA on startup that verifies there is no other instance of Access already running and / or shuts down the previous instance? I have found similiar posts here, but not quite what I'm looking for. I'd appreciate any assistance I can get. Thanks.
Oct 8 2009, 06:30 PM
Welcome to UA
might be what you're looking for
Oct 9 2009, 12:52 PM
Thank you both for your response. This has pointed me in the right direction. However, when I paste this code into a module, it causes my AutoExec to stop working. (I use the AutoExec to "lock down" the databse for the users) I'm self taught in VBA and don't fully understand all of that code you pointed me to, but I will list my AutoExec below and maybe you could tell why it conflicts? Thanks again for the help.
Macro AutoExec = RunCode SetStartupProperties()
'These values are changed to True for my "unlocked" version
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, False
ChangeProperty "AllowBuiltinToolBars", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowShortcutMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
' Unknown error.
ChangeProperty = False
DoCmd.SelectObject acTable, , True
Oct 9 2009, 02:14 PM
Nevermind. I relocated the new code to be in a module all by itself and called it through AutoExec right after my SetStartupProperties and it works perfectly!! Thank you both for pointing me in the right direction, I never would have figured that all out on my own!! :-)
Oct 10 2009, 04:13 PM
You're very welcome, glad you got it working. Mark and I are happy to help