Results 1 to 5 of 5
  1. #1
    New Lounger SadieAnn's Avatar
    Join Date
    Jun 2006
    Location
    Fort Worth, Texas, USA
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi,

    I’ve written several programs with an Access front- and backend, but more recently I have been involved in several web projects. I was instructed to change one of my programs from an Access backend to SQL and convert it to Access 07. I have been able to work everything out except this one problem. In VB.net we can use the following to verify permissions and change the flow of the program.

    If WhoAreYou.User.IsInRole(UserDomainName & "\" WindowsUserGroup) = True….

    How do we do this in Access VBA?

    Thanks for your help,
    SadieAnn

  2. #2
    Star Lounger
    Join Date
    Jan 2010
    Location
    Oregon
    Posts
    61
    Thanks
    9
    Thanked 0 Times in 0 Posts
    One way to accomplish this is to use an Access 2007 Managed Add-In. Since you're dealing with the web, might as well call web services. Using the Managed Add-In, you can make VB.NET calls. Check out this page: http://msdn.microsoft.com/en-us/library/aa902693.aspx

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    This is the VBA function I use for that job with Access mdb files.

    Code:
    Public Function fnIsGroupMember(strGroupName As String) As Boolean
    	Dim wks As Workspace
    	Dim grp As Group
    	Dim usr As User
    	Dim boolinGroup As Boolean
    	On Error GoTo fnIsGroupMember_Error
    
    	boolinGroup = False
    	Set wks = DBEngine.Workspaces(0)
    	Set grp = wks.Groups(strGroupName)
    
    	For Each usr In grp.Users
     	If usr.Name = CurrentUser Then
     	boolinGroup = True
     	End If
    	Next usr
    	fnIsGroupMember = boolinGroup
    
    Exit_fnIsGroupMember:
    	Exit Function
    
    fnIsGroupMember_Error:
     	MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure fnIsGroupMember of Module Global Code", , "Error in procedure fnIsGroupMember"
     	Resume Exit_fnIsGroupMember
     
    End Function
    Regards
    John



  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    The option John suggests uses Access User Level Security which is still available in .mdb files in Access 2007. However, if you choose the .accdb format, that is no longer available. Another option is to collect the Windows Login using VBA (a search on this forum will find code to do that), and base your security code on that.
    Wendell

  5. #5
    New Lounger SadieAnn's Avatar
    Join Date
    Jun 2006
    Location
    Fort Worth, Texas, USA
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks y'all. I have to put this aside for awhile. Next month I'll look into your suggestions.

    Again, thanks for the tips,
    SadieAnn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •