Simpler access security nearly complete

The Stoat

The Grim Squeaker
Local time
Today, 14:44
Joined
May 26, 2004
Messages
239
Hi all,

I've been trying to find a way of creating a simpler access security.

In the zip file are two databases. The passwords have been set to the word test

Both db's need to be in the same folder.

If you want to open lockout.mdb and bypass the form you need to enter the password and then press the OK button with the shift key held down.

Lockin.mdb - using the following code - opens lockout.mdb which is password protected.

Code:
Option Compare Database
Option Explicit
Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Function OpenPasswordProtectedDB()
Static acc As Access.Application
Dim Lox As Long

' set 2 to 0 to hide this db window DON'T do this yet unless you can find a 
' way of closing this db from Lockout.mdb

Lox = apiShowWindow(hWndAccessApp, 2)

Set acc = New Access.Application
    acc.Visible = True
    acc.OpenCurrentDatabase CurrentProject.Path & "\" & "LOCKOUT.mdb", , "test"
    

End Function


Lockout.mdb has a popup modal form that prevents access to the underlying objects. And because Lockin's module is password protected as is the whole of lockout you can't export the objects into another database.

Anyway;

The bit i'm stuck on is when lockout.mdb is closed i need it to shut Lockin.mdb as well.

If you can do this then you can hide lockin.mdb completely once it has finished opening lockout.mdb

Any ideas how i might do this.


TS
 

Attachments

Try this example: I've ammended the passwords. I wonder if anyone can access the module in Lockin.Mdb or any of the objects in Lockout.Mdb. I hope not. If you use Lockin to open Lockout and you close Lockout afterwards Lockin should also close as well.

TS
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom