Home All Groups Group Topic Archive Search About

Make mdb Read Only in code?

Author
14 Sep 2006 12:01 PM
JohnB
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.

Author
14 Sep 2006 12:09 PM
Rick Brandt
JohnB wrote:
Show quoteHide quote
> 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.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com
Author
14 Sep 2006 12:30 PM
JohnB
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.

Show quoteHide quote
"Rick Brandt" wrote:

> JohnB wrote:
> > 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.
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
>
>
Author
14 Sep 2006 1:23 PM
Rick Brandt
JohnB wrote:
> 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.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com
Author
14 Sep 2006 1:58 PM
JohnB
OK Rick, thanks. Maybe someone else will have an idea or maybe I need to
grasp the full security nettle.

Cheers

Show quoteHide quote
"Rick Brandt" wrote:

> JohnB wrote:
> > 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.
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
>
>
Author
14 Sep 2006 2:53 PM
Rick Brandt
"JohnB" <Jo***@discussions.microsoft.com> wrote in message
news:520A5861-8883-4D94-A213-8B0AE84011C8@microsoft.com...
> 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.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com
Author
14 Sep 2006 8:45 PM
JohnB
Thanks for giving this some more thought Rick. I'll have to take a while to
think about this.

Cheers

Show quoteHide quote
"Rick Brandt" wrote:

> "JohnB" <Jo***@discussions.microsoft.com> wrote in message
> news:520A5861-8883-4D94-A213-8B0AE84011C8@microsoft.com...
> > 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.
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
>
>