Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shift - enter. Please help!

Status
Not open for further replies.

djeeten

Programmer
Mar 13, 2003
59
0
0
BE
Hi,

I know this question has been asked before, and I have read the faq about this, but I don't know what to do with it.

I have this application in access, called supply management. The application starts with the form frmLogon. But when a user opens the application with shift+enter, the whole database is shown, which should not happen.

This code is suggested in the faq:
-----------------------------------
'This Code Disables the Shift Key'Public Sub DisableByPassKeyProperty()
Dim db As Database
Dim prp As Property
Set db = CurrentDb
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
db.Properties.Append prp
End Sub
---------------------------

But where should I put this code? Behind frmLogon where the application starts with?

Also, certain users should be able to see the whole database. The faq suggest this to re-enable the shift key:
--------------------------
'This Code Re-enables the Shift Key'Public Sub EnableByPassKeyProperty()
Dim db As Database
Set db CurrentDb
db.Properties.Delete "AllowByPassKey"
db.Properties.Refresh
End Sub
------------------

But again, where should I put this code? Behind a button on the switchboard of those users (they have different switchboard)?

Any help would be really appreciated!!!

Thanks a lot in advance,

dj



 
No, unfortunately startup properties are just that--for starting up. So the only way to make something like that take effect is to run it BEFORE the user in question starts the application--i.e. either the last time you close it, if you make separate copies, or on a kind of startup-close-startup procedure (much more of a pain to handle.)

You can try it yourself; make two copies of the file; run the procedure to disable in one, and to enable in the other. Close them down, start them up, and see what happens.
 
... Also, certain users should be able to see the whole database ...

I think you should consider splitting the database in a front end (database with code, forms, etc.) and a backend (database with only data).

If you switch off the bypass key, it should be impossible for anyone (including you!) to go around the startup sequence. So if you do it, either make some function (command-line, maybe) to switch it back on, or keep a backup of the database. If you keep a backup, you'll see the advantage of a separate front-end as well.

Best regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top