Password protect a form?

lead 27

Registered User.
Local time
Today, 06:20
Joined
Mar 24, 2007
Messages
147
Hi

i am wondering if it is possible to password protect a form?

I am building a DB which will hold personal information, all this info will be held in a table and displayed on a form, but I would like it so that the user has to enter their user name and password and only the form which relates to their details opens ( so like an open form and display specific field but passworded)

Any ideas?
 
You could use the standard built-in security. You don't have to worry about a password for a single form because only designated people can open the form. If you don't want that, you can program the Form_Open event.
 
Command button syntax you could try

If InputBox("Enter Password?", "") = "Sesame"
Then
doCmd.openForm "myForm"

Else
msgbox "Incorrect Password!"
End If
 
Hi,

You could always capture the users windows login details and if that's the same user Id then that could drive the details displayed on the form. So unless they're able to log in as somebody else they could only ever see their details.
The code below I use to capture the users details and this is compared to a table I hold of users information, if their details are correct it opens ok, if not they receive and error box telling them to call me!

Code:
  DoCmd.SetWarnings False
    Dim oNet, oComp As Object
    Set oNet = CreateObject("WScript.Network")
    Set oComp = CreateObject("WScript.Network")
    UserName = oNet.UserName
    ComputerName = oComp.ComputerName
        If (IsNull(DLookup("[UserName]", "FIAUsers", "[Login] ='" & Me.UserName & "'"))) Then
            If MsgBox("FIA Database not utilised for over 3 months" & Chr(13) & Chr(10) & " - ACCESS SUSPENDED - " & Chr(13) & Chr(10) & "Please contact Matthew King on 5034.", vbExclamation, "ERROR") = vbOK Then
            DoCmd.Quit
            End If
        End If
    DoCmd.OpenQuery "qryUpdateUsage", acViewNormal
   
    Me.Caption = [UserName] & "- Welcome to the FIA Database"
    Me.Requery
    DoCmd.SetWarnings True
 

Users who are viewing this thread

Back
Top Bottom