Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    18

    Unanswered: Adding User groups to login

    I'm using the following code OnOpen to check for a specific user group.

    Private Sub Form_Open(Cancel As Integer)
    If Not MatchUserGroup(CurrentUser, "engineering") Then
    DoCmd.Close
    End If
    End Sub

    It works ok, but i'm struggling with the syntax to get it to allow more than one user group.

    I presume it's an ELSE IF statement or an OR statement. I've no experience of VB and any help to add a check to allow "management" as well would be greatly appreciated.

    Thanks

    Dave

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: Adding User groups to login

    Originally posted by thesponz
    I'm using the following code OnOpen to check for a specific user group.

    Private Sub Form_Open(Cancel As Integer)
    If Not MatchUserGroup(CurrentUser, "engineering") Then
    DoCmd.Close
    End If
    End Sub

    It works ok, but i'm struggling with the syntax to get it to allow more than one user group.

    I presume it's an ELSE IF statement or an OR statement. I've no experience of VB and any help to add a check to allow "management" as well would be greatly appreciated.

    Thanks

    Dave
    Try
    If Not MatchUserGroup(CurrentUser, "engineering") OR _
         Not MatchUserGroup(CurrentUser, "management") Then
      DoCmd.Close
    End If

  3. #3
    Join Date
    Oct 2003
    Posts
    18
    Sounds good, but it's not working. (

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by thesponz
    Sounds good, but it's not working. (
    Try AND insted of OR?
    I'm not sure!

Posting Permissions

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