Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password to view a table, run the Queries or reports?

Status
Not open for further replies.

Wrecker

Technical User
Aug 29, 2001
126
US
I have a database being used to record peoples time. I need the operators to be able to Create a new record, but I would only want Supervisors to be able to view the table,run the queries or reports. Is there a way to require a password for the sensitive information?

Thanks in Advance
Wrecker
 
I'm an intermediate developer and maybe there is some way to password protect a table that I am unaware of. But if this helps what I would do is have two copies of your DB and password protect the DB that the supervisors use and for the operators DB, go to the tools menu and under start up uncheck all of the toolbar and menu options and select the form they use as the Display/Form Page. This way all they will have access to is the form. Of course now you have to concern yourself with updating but I know of no way to protect a table in an open DB. If some does know I would like to find out too. Hope this is helpful.
 
Hey guy, I'm looking for password help myself, however I know this one or at least this is what I use. I have a command button to open certain screens. By using this piece of code I get what I want. Here is the code I use:

Public gstrPWD As String
Private Sub Command3_Click()

strPWD = "biggie"

If InputBox("Please Enter Password") = strPWD Then

Dim stDocName As String

stDocName = "Name of the form, report or table you want the person to be able to open" I.E "Form"

DoCmd.OpenForm stDocName, acNormal

Else
MsgBox "You do not have proper security to continue"
End If
End Sub

Now don't get too happy. There is a problem with this one. When the person types in the password everybody can see it. I'm trying to get a response back on how to mask the input.

[peace]
 
Try this. Create a password form ("frmPassword") with a single text box (I called it PasswordBox), an "enter" button, and a "cancel" button. In the form's module post the following code;

Function WhatisThePassword()
Dim Password As String
Dim Response As Integer
Dim strMsg As String

If IsNull(PasswordBox) Then
strMsg = "You must enter a password."
Response = MsgBox(strMsg, vbCritical + vbOKOnly, "Enter Password")

Exit Function
End If

If PasswordBox <> &quot;Youguessedit&quot; Then
strMsg = &quot;You are not authorized to access this function.&quot;
Response = MsgBox(strMsg, vbCritical + vbOKOnly, &quot;Incorrect Password&quot;)

Else
DoCmd.OpenForm &quot;YourForm'sName&quot;
DoCmd.Close acForm, Me.Name
End If

End Function

Private Sub cmdCancel_Click()
DoCmd.Close acForm, YourForm'sName
End Sub

Private Sub cmdButtontoOpenForm_Click() 'Calls the function

If IsitOpened = True Then
DoCmd.OpenForm &quot;YourForm'sName&quot;
Exit Sub
End If

DoCmd.OpenForm &quot;frmPassword&quot;

End Sub

'Determine if the Criteria Form is opened.
'If the form is opened, don't open the password box.
'Show the Form

Function IsitOpened() As Boolean
If IsLoaded(&quot;YourForm'sName&quot;) Then
Cancel = True
IsitOpened = True
End If
End Function
 
Try this. Create a password form (&quot;frmPassword&quot;) with a single text box (I called it PasswordBox), an &quot;enter&quot; button, and a &quot;cancel&quot; button. In the form's module post the following code;

Function WhatisThePassword()
Dim Password As String
Dim Response As Integer
Dim strMsg As String

If IsNull(PasswordBox) Then
strMsg = &quot;You must enter a password.&quot;
Response = MsgBox(strMsg, vbCritical + vbOKOnly, &quot;Enter Password&quot;)

Exit Function
End If

If PasswordBox <> &quot;Youguessedit&quot; Then
strMsg = &quot;You are not authorized to access this function.&quot;
Response = MsgBox(strMsg, vbCritical + vbOKOnly, &quot;Incorrect Password&quot;)

Else
DoCmd.OpenForm &quot;YourForm'sName&quot;
DoCmd.Close acForm, Me.Name
End If

End Function

Private Sub cmdCancel_Click()
DoCmd.Close acForm, YourForm'sName
End Sub

Private Sub cmdButtontoOpenForm_Click() 'Calls the function

If IsitOpened = True Then
DoCmd.OpenForm &quot;YourForm'sName&quot;
Exit Sub
End If

DoCmd.OpenForm &quot;frmPassword&quot;

End Sub

'Determine if the Criteria Form is opened.
'If the form is opened, don't open the password box.
'Show the Form

Function IsitOpened() As Boolean
If IsLoaded(&quot;YourForm'sName&quot;) Then
Cancel = True
IsitOpened = True
End If
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top