Results 1 to 3 of 3
  1. #1
    MdHaziq is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Singapore
    Posts
    124

    Recreate Inventory 2007 Template Database

    Hello,
    Forum

    I have 2 questions.


    1. I would like to recreate inventor 2007 template Database.



    I got stuck at creating the form because I tried to give names based on my wants. (Shouldn't have)

    2. I want to create a login form for users to login before they can enter and filter form based on their section
    The Employee for some reason the first record will change to 1.


    The passwords for the Employees are Employees.
    Example,tblEmployee.ID =1, Employee = SngBF,EmpPassword = SngBF

    Sorry I do not know SQL

    TIA

    Haziq
    (Eager to learn)
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    when user opens the db, the Login form will open and read their userID.
    The user enters their userid and password.
    The code authenticates it against WINDOWS login, and either lets them into the main menu or exits.

    the tUsers table only has their name and loginid. No need to control passwords since Windows does that.
    By having their name in the tUsers table is another level of security that they are allowed into the database.

    I grab the userID when they open the login screen
    vUser = Environ("Username")


    Code:
       'user click LOGIN button
    sub btnLogin_click()
    vUser =  Environ("Username")
    If WindowsLogin(txtUser, txtPass, txtDom) Then
       if vUser = Dlookup("[UserID]","tUsers","[userID]='" & vUser & "'") then
         DoCmd.OpenForm "frmMainMenu"
         DoCmd.OpenForm "frmLogin"
         DoCmd.Close
      else 
         msgbox "You do not have rights for this app"
         docmd.quit
      endif
     
    
    Else
       MsgBox "LOGIN INCORRECT", vbCritical, "Bad userid or password"
       'docmd.quit   'exit access
    End If
    end sub
    
    
    
    Public Function WindowsLogin(ByVal strUserName As String, ByVal strpassword As String, ByVal strDomain As String) As Boolean
            'Authenticates user and password entered with Active Directory.
    
            On Error GoTo IncorrectPassword
            
            Dim oADsObject, oADsNamespace As Object
            Dim strADsPath As String
            
            strADsPath = "WinNT://" & strDomain
            Set oADsObject = GetObject(strADsPath)
            Set oADsNamespace = GetObject("WinNT:")
            Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strDomain & "\" & strUserName, strpassword, 0)
            
            WindowsLogin = True    'ACCESS GRANTED
            
    ExitSub:
            Exit Function
            
    IncorrectPassword:
            WindowsLogin = False   'ACCESS DENIED
            Resume ExitSub
    End Function

  3. #3
    MdHaziq is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Singapore
    Posts
    124
    Hello,
    ranman256

    Thanks for the code!

    But I have this situation that they are using a shared PC to access the database. (without logging out)

    I have to create a login form to authenticate the users who would like to use the database so that I can filter them out based on their title and section.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-16-2018, 02:07 AM
  2. Inventory 2007 Template
    By MdHaziq in forum Access
    Replies: 3
    Last Post: 01-15-2018, 10:51 PM
  3. Replies: 0
    Last Post: 02-05-2016, 01:52 AM
  4. Replies: 12
    Last Post: 03-11-2015, 08:13 PM
  5. Inventory template question
    By bbrazeau in forum Programming
    Replies: 2
    Last Post: 10-03-2011, 02:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums