Password protecting a Form

C

Craigiharper

I am trying to password protect an individual form in my
database. I have followed the instructions in Knowledge
Base Article 209871 and the when i enter any password i
get a message saying 'Primary Key is not an Index in this
table' and the form opens up anyway no matter what
password is entered. I have checked all the code that i
have entered while following the instructions and i have
followed it letter for letter. Any ideas would be
gratefully received. Thanks!
 
D

Douglas J. Steele

Did you create the tblPassword and add a primary key to it? What's the name
of the primary key?

The code in the example uses PrimaryKey (no space), while the error message
you posted has Primary Key (with a space)
 
C

Craigiharper

Many thanks, that works perfectly. I wonder if you could
tell me where i can change the password, i think it is in
the section of code under point 4 in the example in
article 209871, is this correct?
 
D

Douglas J. Steele

In step 9, you inserted a row into the table setting ObjectName to the name
of the form, and KeyCode to 2818. That 2818 value was what results from
passing the password PassWord to the KeyCode function in step 4.

Therefore, to change the password, pass whatever password you want to the
KeyCode function, and store whatever it returns in the table.

No offence, but if you don't understand the code in that article, perhaps
you shouldn't be using it, as it may lead to future problems for you.
 

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