Enable/Disable table or form?

romio

Registered User.
Local time
Yesterday, 16:02
Joined
Apr 20, 2005
Messages
68
Enable/Disable table or form?

After setting both accounts if user is accessing the database then I want to disable him from editing or adding a new record sth like this Form(name).enable = false and if the user is admin then he can edit and add records Form(name).enable = true, is that possible?

am not sure if I have to use the enable or locked property :)

This is my code
Code:
Private Sub Command7_Click()
Dim strSql As String
Dim rs As DAO.Recordset



strSql = "Select adminpass From admin"
Set rs = CurrentDb.OpenRecordset(strSql, dbOpenForwardOnly)


If ((Nz(txtpassword, "") = "") Or (Nz(combusername, "") = "")) Then

MsgBox "Please Enter A Valid Access", vbOKOnly, "Error"

ElseIf (txtpassword = rs!adminpass And combusername = "admin") Then

DoCmd.Close acForm, "Secure"
DoCmd.OpenForm "Home"
 

ElseIf (txtpassword = "user" And combusername = "user") Then

DoCmd.Close acForm, "Secure"
DoCmd.OpenForm "Home"

Else

MsgBox "Wrong Password, Please Try Again", vbOKOnly, "Error"
combusername = ""
txtpassword = ""
combusername.SetFocus


End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom