how to prevent the user from opening the database window

P

Paul James

How can I prevent users from opening the database window in Access 2k and
still have a way to open it myself?

(I'm deploying mdb files).

Thanks in advance,

Paul
 
P

Paul James

Thanks for the reference, Jeff.

I downloaded the mdb utility file and tried running it, but I'm getting a
"Property not found - 3270" error message in the ChangeProperty function.
This error message occurs on the line of the function that says:

dbs.Properties(strPropName) = varPropValue

One surprising thing about this error is that the ChangeProperty() function
is also provided in Access help on the AllowBypassKey property in Access.
As best I can tell, the Function, the calling Sub, and the arguments all
conform to the example in Access help.

The utility mdb file is so simple to run, that I'm fairly confident I
haven't done anything wrong. Has anyone been able to get this utility file
to run without an error?

Another question I have on this subject is whether this utility, if I could
get it working, would also disable the user's ability to display the
database window by pressing the F11 key. If not, then it wouldn't
accomplish very much if you manage to bypass the supression of the window at
startup if the user could open it by simply pressing F11.

Any help on these issues would be great.

Thanks in advance,

Paul
 
J

Jeff Conrad

Hi Paul,

Comments below...
Thanks for the reference, Jeff.

You're welcome.
I downloaded the mdb utility file and tried running it, but I'm getting a
"Property not found - 3270" error message in the ChangeProperty function.
This error message occurs on the line of the function that says:

dbs.Properties(strPropName) = varPropValue

I believe this is a References problem. Most likely if you are using Access 2000 or 2002 a Reference
has not been set to the DAO library. Access is confused about whether you want to use ADO or DAO.
The list of objects with the same names in the 2 models is Connection, Error, Errors, Field, Fields,
Parameter, Parameters, Property, Properties and Recordset

Easiest thing to do is to set a reference to the DAO library under Tools | References for Albert's
utility. Hold down the shift key while opening the utility to bypass the Startup options. Then set a
reference to the DAO library. If you need help doing that, post back and I'll give further
instruction. Then compile the code and close. Everything should work just fine after that.
One surprising thing about this error is that the ChangeProperty() function
is also provided in Access help on the AllowBypassKey property in Access.
As best I can tell, the Function, the calling Sub, and the arguments all
conform to the example in Access help.

Exactly. Albert just wrapped up everything into a nice slick utility that you can simply browse to
the correct file and set it with the push of a button. You don't *have* to use Albert's utility to
disable the Shift key, it is just a LOT easier to do so!
The utility mdb file is so simple to run, that I'm fairly confident I
haven't done anything wrong. Has anyone been able to get this utility file
to run without an error?

Explained above. You did not do anything wrong and the utility works just fine with the proper
Reference.
Another question I have on this subject is whether this utility, if I could
get it working, would also disable the user's ability to display the
database window by pressing the F11 key. If not, then it wouldn't
accomplish very much if you manage to bypass the supression of the window at
startup if the user could open it by simply pressing F11.

Not a problem.
1. Go to Tools | Startup
2. Hit the Advanced button
3. Uncheck "Use Special Keys"
4. Hit OK and close database.
5. Hitting F11 now will not bring up the Database Window
Any help on these issues would be great.
Done.

Thanks in advance,

You're welcome.
 
P

Paul James

Jeff - I checked my reference library, and here are the Libraries that are
currently set in my application, shown in the order in the dialog box:

Visual Basic for Applications
Microsoft Access 10.0 Object Library
OLE Automation
Microsoft Visual Basic for Applications Extensibility 5.3
Microsoft DAO 3.6 Object Library

Since the DAO 3.6 library was already installed, I need to do something else
to get the function working. So I tried adding DAO to some of the objects
in the Dim statements:

Dim MyDb As DAO.Database
Dim prp As DAO.Property, and
Function ChangeProperty(strPropName As String, _
varPropType As Variant, _
varPropValue As Variant, _
dbs As DAO.Database) As Integer

Adding the DAO prefix to these objects did eliminate the error message, and
the Function runs without interruption to completion. However, it doesn't
prevent the user from using the Shift key to bypass the Startup options.
While both the Disable and Enable command buttons run without error, they
don't seem to have any effect on the use of the shift key when the target
database opens.

Any ideas about what the problem could be? Could it have anything to do
with the sequence of the reference libraries shown above? (But if I make
any changes, could that cause other problems to occur elsewhere?

TIA,

Paul
 
P

Paul James

It's working just fine, so evidently I just needed to place the DAO prefix
before the Database and Property objects to remove some ambiguity about
which Library should be used.

Thanks for your help on this, Jeff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top