Results 1 to 4 of 4
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: User Lisitng (Access 2000)

    Try this:

    <code>...
    For intLooper = 0 To Cusers - 1
    Forms!frmUser!txtUser = Forms!frmUser!txtUser & vbCrLf & _
    "User" & intLooper + 1 & ":" & _
    DLookup("PC_User_Name", "SSD_OWNER_SSD_DB_PC_USERS", _
    "PC_NUMBER =" & Chr(34) & lpszUserBuffer(intLooper) & Chr(34))
    Next
    ...</code>

  2. #2
    Star Lounger
    Join Date
    Mar 2003
    Location
    Summerville, South Carolina, USA
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User Lisitng (Access 2000)

    Works perfectly. I was on the right track. I just did not have the chr(34) added.

    Thanks Again

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: User Lisitng (Access 2000)

    You need them to include string values in a string - the Chr(34) is a double quote. For numeric values, you wouldn't need them.

  4. #4
    Star Lounger
    Join Date
    Mar 2003
    Location
    Summerville, South Carolina, USA
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    User Listing (Access 2000)

    I currently have the following code to access computer numbers for those users (pc numbers) that are in the a database. I also have a table that list the pc numbers with name and phone number. In my "debug window", I want to be able to add the user names. I was thinking along the dlookup function and declaring the user name and just adding it to the end of my intLooper statement. Any idea how this will work?

    Public Function getusers(Optional StrDbPath As String)

    ReDim lpszUserBuffer(100) As String
    Dim intLooper As Integer
    Dim Cusers As Long
    Dim strMsgBox As String
    Dim strDB As String

    On Error GoTo Err_GetUsers


    ' Check to see if a database path was passed
    ' to the function. If the argument was not used,
    ' assume that we're to investigate the .ldb
    ' of the current database.
    StrDbPath = Forms!frmUser!Text10


    ' Set Cusers to the number of computers currently connected
    ' to the database. Insert computer information into the
    ' lpszUserBuffer array.

    ' Arguments of LdbUser_Get Users:
    ' 1 = All users who have logged in since the LDB file was
    ' created
    ' 2 = Only users who are currently logged in
    ' 4 = Only users who are causing the database file to be
    ' corrupted
    ' 8 = Just return the count of users

    Cusers = LDBUser_GetUsers(lpszUserBuffer(), StrDbPath, 2)

    UserName = "Carl Brown"
    'DLookup("PC_User_Name", "SSD_OWNER_SSD_DB_PC_USERS", "Cusers = PC_NUMBER")

    ' Print possible errors returned by the function.
    Select Case Cusers
    Case -1
    strMsgBox = "No one is currently in that Database"
    Case -2
    strMsgBox = "No user connected"
    Case -3
    strMsgBox = "Can't Create an Array"
    Case -4
    strMsgBox = "Can't redimension array"
    Case -5
    strMsgBox = "Invalid argument passed"
    Case -6
    strMsgBox = "Memory allocation error"
    Case -7
    strMsgBox = "Bad index"
    Case -8
    strMsgBox = "Out of memory"
    Case -9
    strMsgBox = "Invalid Argument"
    Case -10
    strMsgBox = "LDB is suspected as corrupted"
    Case -11
    strMsgBox = "Invalid argument"
    Case -12
    strMsgBox = "Unable to read MDB file"
    Case -13
    strMsgBox = "Can't open the MDB file"
    Case -14
    strMsgBox = "No one is currently in that Database"
    End Select

    If Not IsEmpty(strMsgBox) And strMsgBox <> "" Then
    MsgBox strMsgBox, vbInformation, "Get User"
    Exit Function
    End If

    ' Print computer names to Debug window.
    For intLooper = 0 To Cusers - 1
    Forms!frmUser!txtUser = Forms!frmUser!txtUser & vbCrLf _
    & "User" & intLooper + 1 & ":" & lpszUserBuffer(intLooper)
    Next

    Exit_GetUsers:
    Exit Function
    Err_GetUsers:
    MsgBox Err.Description
    Resume Exit_GetUsers

    End Function

    Thanks.

Posting Permissions

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