REstrict Access

  • Thread starter Simon Glencross
  • Start date
S

Simon Glencross

I would like to restrict access to a couple of forms what would be the
easiest way of doing this?

Thanks in advance

S
 
A

Arvin Meyer [MVP]

Set up user-level security and deny permissions to new objects, is one way,
and probably the best way since it has more versatility. You could also make
an MDE file, which will limit creating new objects, but won't stop new
queries. Have a look at the Security FAQ:

Security FAQ
http://support.microsoft.com/download/support/mslfiles/SECFAQ.EXE

Lynn Trapp's summarization:
http://www.ltcomputerdesigns.com/The10Steps.htm

--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
G

Granny Spitz via AccessMonster.com

Simon said:
I would like to restrict access to a couple of forms what would be the
easiest way of doing this?

The best way would be to implement User-level security, but the easiest way
is to set up a simple password on the form, then convert the file to an MDE
so the users can't see the code. In the restricted form's Open event, paste
this:

Private Sub Form_Open(Cancel As Integer)
If (Me.OpenArgs = "OpenSesame") Then
' Open it.
Else
Cancel = True
End If
End Sub

On another form, create a button and paste this into it:

Private Sub cmdOpenRestrictedForm_Click()

On Error GoTo ProcErr

Dim pwd As String

pwd = InputBox("What's the password?")
DoCmd.OpenForm "frmRestricted", , , , , , pwd

Exit Sub

ProcErr:

If (Err.Number = 2501) Then
MsgBox "Sorry. Incorrect password."
Else
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description
End If

Err.Clear
End Sub
 

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