Access Security

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kurai hikari
    New Member
    • Oct 2009
    • 15

    Access Security

    hay iam back . so itis shotokan too? weired i dk but here brown belt is 2 and 1 kius blue one is called 3kiu , green, orange 6 and 5 kiu, yellow 6 and 7 . that is the system here and shotokan too, but anyways itis just amartial art, and yap keep ur self strong :)

    i have another question for u (told ya u won't get rid of me XD)
    this time i don't have adata base or something complicated i just want to ask about the access programme abilities and limits. so i want to know is it possible to creat a user name and password for specific users.

    for example , like when i logg in in yahoo account.i sign up then i logg in after my user name and password are saved in yahoo db

    in access let's say i have a table with 7 names, and i closed my database so no one can access this data base but i want only those 7 people to access the data base, is this possible in access???

    thank you
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32636

    #2
    It is possible (or was at least - I hear they stopped it in Access 2007), but it is really not a very good system for many reasons, one of which is that you either have a scenario where anyone can quite easily get in as Administrator, or you have to manage the whole thing with the possibility of losing access to the file completely if you lose the System.Mdw file. Not to mention how much of a head-ache it is keeping it up-to-date when you make any amendments.

    Personally, where this is a requirement, I tend to get the logged on user's name and check it against the allowed users list (that I store in a table) for each object.

    The code I use for this is :
    Code:
    'GetUser returns the user's logged on name.
    Public Function GetUser() As String
        Dim strUserKey As String
    
        If Environ("OS") = "Windows_NT" Then
            strUserKey = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
            GetUser = RegRead(conHKLM, strUserKey, "DefaultUserName")
        Else
            'Windows
            strUserKey = "Network\Logon"
            GetUser = RegRead(conHKLM, strUserKey, "username")
        End If
    End Function
    It uses an OS function from another module which is :
    Code:
    Private Declare Function RegOpenKeyEx Lib "advapi32.dll" _
        Alias "RegOpenKeyExA" (ByVal hKey As Long, _
                               ByVal lpSubKey As String, _
                               ByVal ulOptions As Long, _
                               ByVal samDesired As Long, _
                               phkResult As Long) As Long
    Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) _
                                 As Long
    Private Declare Function RegQueryValueExStr Lib "advapi32.dll" _
        Alias "RegQueryValueExA" (ByVal hKey As Long, _
                                  ByVal lpValueName As String, _
                                  ByVal lpReserved As Long, _
                                  lpType As Long, _
                                  ByVal lpData As String, _
                                  lpcbData As Long) As Long
    
    Public Function RegRead(ByVal lngHive As Long, _
                            ByVal strKey As String, _
                            ByVal strValue As String) As Variant
        Dim intIdx As Integer, intHK As Integer
        Dim strWork As String
        Dim lngRet As Long, cbLen As Long, lngHKey As Long, lngType As Long
    
        RegRead = Null
        strKey = strKey & Chr(0)
        lngRet = RegOpenKeyEx(lngHive, strKey, 0, conKeyRead, lngHKey)
        If lngRet = conOK Then
            'Create buffer to store value
            strWork = Space(255)
            cbLen = 255
            lngRet = RegQueryValueExStr(lngHKey, _
                                        strValue, _
                                        0&, _
                                        lngType, _
                                        strWork, _
                                        cbLen)
            RegRead = Left(strWork, cbLen - 1)
            If Len(RegRead) = 254 Then RegRead = Null
            'Close key
            Call RegCloseKey(lngHKey)
        End If
    End Function

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32636

      #3
      It's Wado-Ryu, not Shotokan. My mistake.

      Kyus from 1 to 9 are :
      Brown (3 stripes); Brown (2 stripes); Brown (1 stripe); Blue; Green; Orange; Yellow; Red; White.

      I moved your question btw as each question should be in its own thread, though you may post links between threads if it's relevant at all. I will do that here to ensure the conversation makes sense.

      This was split from How to structure an access database.

      Comment

      • kurai hikari
        New Member
        • Oct 2009
        • 15

        #4
        good XD

        yeah itis my mistake srry i should have made anew thread

        thanks so much i gave ur answer to my boss and it was a valuable thanx if there is another question i will come to u defenitly :)

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32636

          #5
          Originally posted by kurai hikari
          yeah itis my mistake srry i should have made anew thread
          Not a big problem. There are things you need to learn in time but you're still quite new.

          Comment

          Working...