Help with some VB Code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • colemanj4

    #16
    Re: Help with some VB Code

    On May 6, 9:56 pm, "Albert D. Kallal" <PleaseNOOOsPAM mkal...@msn.com >
    wrote:
    Actually, I have to run right now...but, let me take a look at this later
    tonight....
    >
    I do think something can be cooked up here.....
    >
    --
    Albert D. Kallal    (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKa l...@msn.com

    Below is what I have now, I have defined the function
    'NetworkUserNam e' to return the login name of the user. I want (where
    the comments are) to change their user type (as defined in the *.ldb)
    to be User instead of Admin, as User only has read only access to the
    DB.

    Been searching how to do that and can't find it, any help you could
    provide would be awesome.


    Sub LockDB()

    Dim Show_Box As Boolean
    Dim Response As String
    Dim userName As String

    userName = NetworkUserName ()

    Show_Box = True

    While Show_Box = True

    Response = InputBox("Enter the Password for Admin. Cancel to
    Enter as Read-Only", _
    "Read-Only Unlocking")

    'See if Cancel was pressed.
    If Response = "" Then

    'Set userName to the User group HERE
    MsgBox "You can look at anything, but change nothing"
    Show_Box = False


    Else
    'Test Entry to find out if it is the correct password.
    If ("safety" = Response) Then

    MsgBox "You are granted Admin rights"
    'set userName to the Admin group HERE
    Show_Box = False

    Else

    ' If the entry was wrong, show an error message.
    MsgBox "Wrong Password, Try again."

    End If
    End If
    Wend

    End Sub

    Thanks

    Comment

    Working...