PC Review


Reply
Thread Tools Rate Thread

Different Access for Different Objects

 
 
Pab
Guest
Posts: n/a
 
      11th Dec 2003
Hi,

Here is the situation: I am trying to create a Vacation
Request Form in our company. I want to create a form that
has two parts:

1. The first part will give access to the employee to
fill info such as Name, vacation start date, vacation end
date, etc.. that will all be stored in a table that's
already created. Easy so far.

2. The second part will have a check box or a radio
button (In the same form) for the supervisor to just
approve or deny the vacation. The hard part is, how do I
give access to the supervisor ONLY with out giving access
to the employee for this "Approval" field?

3. I just thought of a third part :-) How do I give
access only to that person who has filled out this
specific form, so other employees will not be able to
change this employee's record?

Note: I am using the "User Level Security", but that only
gives me different rights on the Form itself, not parts
of the form.

Thanks all
 
Reply With Quote
 
 
 
 
Scott McDaniel
Guest
Posts: n/a
 
      11th Dec 2003
Hopefully you have setup a Managers group in your security setup. If so,
then simply check for membership in that group in the BeforeUpdate event of
your checkbox:

Public Function IsCurrentUserInGroup(ByVal GroupName As String) As Boolean
'note: credit for this code goes to Brendan Reynolds
Dim usr As DAO.User
Dim grp As DAO.Group

Set usr = DBEngine.Workspaces(0).Users(CurrentUser())
For Each grp In usr.Groups
If grp.Name = GroupName Then
IsCurrentUserInGroup = True
Exit For
End If
Next grp
Set grp = Nothing
Set usr = Nothing

End Function


Sub MyCheckBox_BeforeUpdate(Cancel As Integer)
If IsCurrentUserInGroup("Managers") = False Then
Msgbox "Only members of the Managers group can approve this
schedule", vbOKOnly
Cancel = True
End If
End Sub

As far as allowing users to view their records only, base your form on a
query and filter the form based on the CurrentUser. To do this, you'll need
to add a field to the table storing the scheduling data, and store the value
of CurrentUser when a new record is added. Then on logon, you filter your
form based on the value stored in that field:

SELECT * FROM tblSchedule WHERE strUser = ' " & CurrentUser & " ' "

In this manner users see only those records they have added.
--
Scott McDaniel
CS Computer Software
Visual Basic - Access - Sql Server - ASP
"Pab" <(E-Mail Removed)> wrote in message
news:065f01c3bf9f$5d5d80a0$(E-Mail Removed)...
> Hi,
>
> Here is the situation: I am trying to create a Vacation
> Request Form in our company. I want to create a form that
> has two parts:
>
> 1. The first part will give access to the employee to
> fill info such as Name, vacation start date, vacation end
> date, etc.. that will all be stored in a table that's
> already created. Easy so far.
>
> 2. The second part will have a check box or a radio
> button (In the same form) for the supervisor to just
> approve or deny the vacation. The hard part is, how do I
> give access to the supervisor ONLY with out giving access
> to the employee for this "Approval" field?
>
> 3. I just thought of a third part :-) How do I give
> access only to that person who has filled out this
> specific form, so other employees will not be able to
> change this employee's record?
>
> Note: I am using the "User Level Security", but that only
> gives me different rights on the Form itself, not parts
> of the form.
>
> Thanks all



 
Reply With Quote
 
 
 
 
Pab
Guest
Posts: n/a
 
      13th Dec 2003
Scott,

Although most of your reply is over my head (For now),
you sure have gotten me excited about the capablities of
Access. I will be doing more research on this. Does this
code have to do anything with VBA? Is there a nice
website that will get me started with this functionality
step by step? Much appreciated.

>-----Original Message-----
>Hopefully you have setup a Managers group in your

security setup. If so,
>then simply check for membership in that group in the

BeforeUpdate event of
>your checkbox:
>
>Public Function IsCurrentUserInGroup(ByVal GroupName As

String) As Boolean
>'note: credit for this code goes to Brendan Reynolds
> Dim usr As DAO.User
> Dim grp As DAO.Group
>
> Set usr = DBEngine.Workspaces(0).Users(CurrentUser())
> For Each grp In usr.Groups
> If grp.Name = GroupName Then
> IsCurrentUserInGroup = True
> Exit For
> End If
> Next grp
> Set grp = Nothing
> Set usr = Nothing
>
>End Function
>
>
>Sub MyCheckBox_BeforeUpdate(Cancel As Integer)
> If IsCurrentUserInGroup("Managers") = False Then
> Msgbox "Only members of the Managers group can

approve this
>schedule", vbOKOnly
> Cancel = True
> End If
>End Sub
>
>As far as allowing users to view their records only,

base your form on a
>query and filter the form based on the CurrentUser. To

do this, you'll need
>to add a field to the table storing the scheduling data,

and store the value
>of CurrentUser when a new record is added. Then on

logon, you filter your
>form based on the value stored in that field:
>
>SELECT * FROM tblSchedule WHERE strUser = ' " &

CurrentUser & " ' "
>
>In this manner users see only those records they have

added.
>--
>Scott McDaniel
>CS Computer Software
>Visual Basic - Access - Sql Server - ASP
>"Pab" <(E-Mail Removed)> wrote in

message
>news:065f01c3bf9f$5d5d80a0$(E-Mail Removed)...
>> Hi,
>>
>> Here is the situation: I am trying to create a Vacation
>> Request Form in our company. I want to create a form

that
>> has two parts:
>>
>> 1. The first part will give access to the employee to
>> fill info such as Name, vacation start date, vacation

end
>> date, etc.. that will all be stored in a table that's
>> already created. Easy so far.
>>
>> 2. The second part will have a check box or a radio
>> button (In the same form) for the supervisor to just
>> approve or deny the vacation. The hard part is, how do

I
>> give access to the supervisor ONLY with out giving

access
>> to the employee for this "Approval" field?
>>
>> 3. I just thought of a third part :-) How do I give
>> access only to that person who has filled out this
>> specific form, so other employees will not be able to
>> change this employee's record?
>>
>> Note: I am using the "User Level Security", but that

only
>> gives me different rights on the Form itself, not parts
>> of the form.
>>
>> Thanks all

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copied/Pasted objects move/reformat pre-existing objects =?Utf-8?B?R3JlYXQgU2NvdHQgNzc=?= Microsoft Powerpoint 1 3rd May 2005 05:38 AM
100% Free MS Access .NET Code Generator (tired of hand cranking business objects/data objects) ? MyGeneration Microsoft Access 0 27th Jan 2005 05:55 AM
Objects, objects, so many objects! ;-) thechaosengine Microsoft Dot NET 11 18th Dec 2004 01:35 PM
Objects, objects, so many objects! ;-) thechaosengine Microsoft C# .NET 10 16th Dec 2004 05:04 PM
Unable to remove Sheet objects in the Microsoft Excel Objects Adrian Microsoft Excel Programming 1 26th Aug 2004 10:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:47 AM.