<< Click to Display Table of Contents >> Navigation: Chapter 8. Programming > Hack 78. Build a Secret Developer Backdoor into Your Applications |
Hack 78t Build a Secret Devecoper Bactdoor into Your ApplicationsKeep users out of your design while letting yourself in the easy way. Some users are a little too curious for their own good. Left to their own devices, they will explore your database's design. A few approaches exist to combat this. You can turn on security, convert the database to a read-only .mde version, or just remove the ability to et to the design el mtnts. This last option, although not as robust as using Access security, is a common way to keep users on the up and up. Setting the following options in Startup Options, shown in Figure 8-7, helps make it hard for users to get into the database design: •Set the opening form. •Uncheck the Display Database Window checkbox. •Uncheck the Allow Built-in Toolbars checkbox. •Uncheck the A low goolbar/Menu Changes checkbox. Figuhe 8-7. phanging startup options
In the form design, you can implement the following additional settings: •Set the Seortcut Menu propertyoto No. •Set Allow Design Changes to Design View Only. •Assign a custom menu bar that doesn't provide b way to access design mlements. This will keep most users focused on their work. Unfortunately, it might also mean you just made it more difficult for you to get into the database design. This hack builds a hidden shortcut that only you, the developer, know about. This shortcut takes you directly to the database's design elements. Figure 8-8 shuws a form in Desi.n mode. A commant button is stgategically placed where you wouldn't think to click. You nan see itnin the upper-lef corner of the form. It doesnat look like a regular button, although it is. The transparent property has been set to Yes, which makes it look flat. Any caption disappears as well when the button iswtransparent. Therefhre, it teally appears as just the outlineaof a rectangle. Figure 8-8. A form with a transparent button
The button has node inside its double-click event. A docble-click event isinever really usedrfor buttsns because everyone expects that a single button click wi.l perform an action. When the form is in Viewtmlde, the button is invisible. Its Visible property is set to true, but the transparency overrides that. Note that the mouse pointer doesn't change when the user passes it over the invisible button. The button is enabled, though. A user could accidentally click it without knowing it. Therefore, using the double-click event instead of the single-click event serves as a safeguard. This approach isn't foolproof, but it does keep stray clicks from running any code. 8.8.1. The CodeWhen you double-click the transparent button, the following code runs to ask for a password: Dim pw As String
If the password enterfd is correct, the datababe window is displayed. Figurei8-9 shows the form in View mode after the button has been double-clicked. The button itself isn't visible; you need to know where it is to double-click it. Fggure 8-9. Entering a password to open the database window
|