Yes, set the allowbypass proeprty of teh databse to false, but you will have to do more than that since savvy user can just press F11 to see db window, you need to also disable the F11 key
Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now -
create a splash screen.
put two buttons on the screen name them "Lock" and "Unlocked"
in the code for the unlock button put this code in the on click event:-
================================
Private Sub Command23_Click()
Dim db As Database
Set db = CurrentDb
db.Properties.Delete "AllowByPassKey"
MsgBox "Access!", vbExclamation
db.Properties.Refresh
End Sub
================================
in the code for the lock button put this code in the on click event:-
================================
Private Sub Command22_Click()
Dim db As Database
Dim prp As Property
Set db = CurrentDb
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
MsgBox "No Access!", vbExclamation
db.Properties.Append prp
End Sub
================================
now set the buttons in a place only you know about and set there visible property to false.
that only you will know where they are.
Send me your email address and I will send you a cool little appilcation I wrote to lock down and unlock your database.
Then you can check out the source code you see how I did it.
You are clearly using a version Access later than Access97, and presumably you have ADO and DAO libraries in your list of references. Some object names are common between these two libraries, it is therfore wise to qualify Dim's with library name so
Dim db as DAO.Database
Dim prp as DAO.Property
etc etc
Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now -
I know this is really old but I can't get my command buttons to work when they aren't visible - why is that? Note that the code is fine if I create a form and run it from a command button but that form is never used again and is unbound. Of course this means I can only lock it and not unlock it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.