Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    User Information through code (Access 2K SR2)

    I need to get user information after the user logs in using Access security. This information will determine the recordset that the user sees. Does anyone know how to pull this information out with VB code?

  2. #2
    New Lounger
    Join Date
    Sep 2001
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User Information through code (Access 2K SR2)

    In Access 2000, use ADOX to retrieve the user information. In Access 97, use DAO and the workspace to retrieve that info.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User Information through code (Access 2K SR2)

    Not sure what ADOX is but I read up.

  4. #4
    Star Lounger
    Join Date
    Feb 2001
    Location
    Wirral, Merseyside, Merseyside, England
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User Information through code (Access 2K SR2)

    I create a startup form and add an on open event, this is an example from Access 97, but may work for you.

    Private Sub Form_Open(Cancel As Integer)
    DoCmd.SetWarnings False
    Dim TheUser

    TheUser = CurrentUser() ' Initialize variable.

    Select Case TheUser ' Evaluate case.
    Case "Admin" ' default user
    DoCmd.OpenForm "FrmUser"
    Forms!FrmUser!OffNo.SetFocus
    DoCmd.close acForm, "FrmStartup"

    Case "Administrator"
    DoCmd.OpenForm "FrmAdministration"
    Forms!FrmAdministration.OffNo.SetFocus
    DoCmd.close acForm, "FrmStartup"

    Case "Supervisor"
    DoCmd.close
    Call fRefreshLinks
    DoCmd.OpenForm "FrmUser"
    Forms!FrmUser!OffNo.SetFocus
    MsgBox "This is not the supervisor database, if you wish to authorise changes please close and open the correct database"
    DoCmd.close acForm, "FrmStartup"

    Case "Master"
    DoCmd.OpenForm "FrmAdministration"
    Forms!FrmAdministration.OffNo.SetFocus
    DoCmd.close acForm, "FrmStartup"

    Case Else ' Other values.
    DoCmd.close acForm, "switchboard"
    DoCmd.OpenForm "FrmUser"

    End Select

    End Sub

    Hop you can amend this for your own use.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: User Information through code (Access 2K SR2)

    ADOX is the "Microsoft ADO Ext. 2.x for DDL and Security". You need it if you're going to manipulate security using ADO code, since that's where the security related object live.
    Charlotte

Posting Permissions

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