Make mdb Read Only in code?

G

Guest

Hi.

I have not implemented full user security on my mdb, basically because of
the number of problems it seems to cause and there is only a small number of
users. Instead, I have a simple password checking form.

Is there a way of making the mdb Read Only if a particular password is
entered? Is there some code that I could add alongside the password checking
code on the form that would do that?

I realise that I'm going to get responses like "don't do it like that" but I
feel I still have to ask.

Thanks for any help.
 
R

Rick Brandt

JohnB said:
Hi.

I have not implemented full user security on my mdb, basically
because of the number of problems it seems to cause and there is only
a small number of users. Instead, I have a simple password checking
form.

Is there a way of making the mdb Read Only if a particular password is
entered? Is there some code that I could add alongside the password
checking code on the form that would do that?

I realise that I'm going to get responses like "don't do it like
that" but I feel I still have to ask.

Thanks for any help.

You could store the password in a public variable and in the OPen event of every
form have code...

If PasswordVariable = "foo" Then
Me.RecordSourceType = "Snapshot"
End If

....and yes this will only be a barrier to people who are very ignorant about
Access.
 
G

Guest

Thanks for the quick reply Rick.

I need to check how I would "store the password in a public variable" but
first I should say that I have kerzillions of forms in this mdb, all of them
accessed through a Tab Control Form. It would be simply impractical to put
code in every form. Isn't there a more global way of doing this?

Thanks again.
 
R

Rick Brandt

JohnB said:
Thanks for the quick reply Rick.

I need to check how I would "store the password in a public variable"
but first I should say that I have kerzillions of forms in this mdb,
all of them accessed through a Tab Control Form. It would be simply
impractical to put code in every form. Isn't there a more global way
of doing this?

Short of having two different files (one in a folder that is set up for read
only access only) I can't think of anything.
 
G

Guest

OK Rick, thanks. Maybe someone else will have an idea or maybe I need to
grasp the full security nettle.

Cheers
 
R

Rick Brandt

JohnB said:
OK Rick, thanks. Maybe someone else will have an idea or maybe I need to
grasp the full security nettle.

You could either...

Write a one-time code routine that would loop through all forms, add the code
and then save them.

Create a replacement function for DoCmd.OpenForm that opens the form and then
changes the Recordsource Type based on the password. Then use a Find and
Replace utility that would go through the entire project replacing
DoCmd.OpenForm with your new function.
 
G

Guest

Thanks for giving this some more thought Rick. I'll have to take a while to
think about this.

Cheers
 

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