Re: Restricting access to database using forms



"vandy" <vandy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F9D32833-364A-41EA-A1EC-CAB767724231@xxxxxxxxxxxxxxxx
Hi All,

I have created a database in access2003 and given selective restrictive
access to users using the security wizard.

I have a user who is not on the network and thus not able to access the
workgoup and secruity mdw files which i have created.

I have created a user login form which checks for user name and password.
Private Sub btnlogin_Click()

If IsNull(Me.quserid) Then
MsgBox ("You Must Enter a Valid User ID !!")
Exit Sub

Else

If IsNull(Me.qpwd) Then
MsgBox ("You Must Enter a Password!!")
Exit Sub

End If
End If

If Me.qpwd.Value = DLookup("PWD", "Authorized", "UserID ='" &
Me.quserid.Value & "'") Then

DoCmd.OpenForm "MainMenu", acNormal
Else
MsgBox ("Invalid Password!Try Again!")
End If
End Sub


Question: How to modify this to enable read only acess to all forms and
screens to a selective user x who is not on the windows network.

Right now i want the user to login in using the login form and when he
types
in his username and pwd all the screens and forms should be read only.

can this be done. Thanks in advance.

It can be done, but it will require some VBA coding. You will first need to
add a field to your Authorized table to indicate whether the user is
read-only. Fetch that value, and then pass something in the OpenArgs
parameter of OpenForm to tell the form to make itself read-only. In the
form's Open event, check the contents of OpenArgs and if it's appropriate,
you can either set the form's Allow Additions, Allow Deletions, and Allow
Edits properties to No (essentially rendering the entire form read-only), or
you can loop through the form's controls (using the Controls collection) and
set each control's Locked property to Yes. I usually do the latter, because
it gives me more granular control over the form; I can leave some controls
unlocked, for example (like a combo box for selecting a record to view).

Look in Access help for the Controls collection for examples of how to
iterate through it and how to use the ControlType property to tell what kind
of control it is. You can also search these newsgroups for more information
on OpenArgs, the Controls collection, and ControlType property.

Carl Rapson


.



Relevant Pages

  • Re: Restricting access to database using forms
    ... in his username and pwd all the screens and forms should be read only. ... you can loop through the form's controls and ... Look in Access help for the Controls collection for examples of how to ... on OpenArgs, the Controls collection, and ControlType property. ...
    (microsoft.public.access.formscoding)
  • Re: ASP.net 2 Master pages menu and saving pages - Weired situation - please help
    ... The only downside here is if you use autopostback instead of AJAX on certain controls. ... But, if you want to just automatically save the stuff, then your nav links in your master page will have to be linkbuttons which will post and execute whatever code is necessary in each of your pages in the Page_Load in an ifblock. ... The problem that I have is that once the users are selecting ... IManageable that the base class implements it. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Shakey mouse in design mode
    ... UpRider, I don't think you can "freeze" the controls. ... you can group controls by selecting them and choosing Group ... frame will be moved. ...
    (microsoft.public.access.forms)
  • Re: Understanding event order ???
    ... one shot or is there some cases where it absolutely require Autopostback to ... listbox and button server controls. ... then next I change the way I use my interface by selecting ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: avoiding select
    ... I use the controls off the control ... >> I am with you I avoid selecting like the plague. ... >>> If you use destination, pasting as link is impossible. ...
    (microsoft.public.excel.programming)

Loading