Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: How can a user logon and filter data in tables?

    I have built my database for a certain department at my workplace :Instrumentation. Now, management wants the mechanical group to access it as well without seeing all the Instrumentation data in it. They will be using the same tables. How can a group logon the database and filter out what the other group has in it?

    Any help here is appreciated...I am still learning...

  2. #2
    Join Date
    Aug 2003
    SW Ohio

    Re: How can a user logon and filter data in tables?

    This is a function off the web site. This will get you the username, which you then can use against a table or query to figure out the department.

    Just a thought.

    ' Declare for call to mpr.dll.
    Declare Function WNetGetUser Lib "mpr.dll" _
    Alias "WNetGetUserA" (ByVal lpName As String, _
    ByVal lpUserName As String, lpnLength As Long) As Long

    Const NoError = 0 'The Function call was successful

    Public Function GetUserName()

    ' Buffer size for the return string.
    Const lpnLength As Integer = 255

    ' Get return buffer space.
    Dim status As Integer

    ' For getting user information.
    Dim lpName, lpUserName As String

    ' Assign the buffer size constant to lpUserName.
    lpUserName = Space$(lpnLength + 1)

    ' Get the log-on name of the person using product.
    status = WNetGetUser(lpName, lpUserName, lpnLength)

    ' See whether error occurred.
    If status = NoError Then
    ' This line removes the null character. Strings in C are null-
    ' terminated. Strings in Visual Basic are not null-terminated.
    ' The null character must be removed from the C strings to be used
    ' cleanly in Visual Basic.
    lpUserName = Left$(lpUserName, InStr(lpUserName, Chr(0)) - 1)

    ' An error occurred.
    MsgBox "Unable to get the name."
    End If

    ' Display the name of the person logged on to the machine.
    'MsgBox "The person logged on this machine is: " & lpUserName
    GetUserName = lpUserName

    End Function
    Jim P.

    Supoorting Oracle, MSSQL7, Sybase 8, & Pervasive. Confusion Reigns

Posting Permissions

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