Log In Read-Only

anshaik

Registered User.
Local time
Today, 02:05
Joined
Jul 8, 2010
Messages
22
Hi everyone,

Question for a log in procedure (user end form) in Access 2003. I have a log in form, in which a user is to type in user name/password in order to get to a main page form where they can branch of to do other tasks (editing, viewing, etc of tables through forms).

I want to have the capability for users without credentials to view all of the forms (through the main page) without being able to edit any of the information in the database. Basically, a user without credentials will click the "Read-Only" button instead of going through the login process and will be able to only view all the forms in the application without making any changes.

Is there some code I can build into my read-only command button that will lock all the forms to uneditable?

Thanks for any help.
 
Yes, use allowedits and set to true or false depending on what they are.

Me.AllowEdits = false

I normally have a global variable, say blnAdminRights, then use

me.allowedits = blnAdminRights

so if the blnAdminRights are TRUE, i.e. an Admin user, the allowedits will be true also, similarly if false...
 
I changed my idea a little bit, and am now attempting to use the allowedits function. Now whenever a user clicks on "Read-Only" it opens a slightly modified main page (a few buttons removed that they would not need). Now, in my main page, where would I insert this allow edits for it to lock the next form opened? For example, my code for one open is:

Code:
Private Sub erOpenCmd_Click()

On Error GoTo Err_erOpenCmd_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "ER_Q"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_erOpenCmd_Click:
    Exit Sub
Err_erOpenCmd_Click:
    MsgBox Err.Description
    Resume Exit_erOpenCmd_Click

End Sub

I assume I cannot just enter the allowedits in the middle of this code? I'm not sure where to put this function.
 
DoCmd.OpenForm "FormName", , , , acFormReadOnly

Note the number of commas.
 

Users who are viewing this thread

Back
Top Bottom