Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search Network (Access 2000 VBA)

    I would like to find all the computers on the network the following file C:LimsFuels Lube LIMS.mdb, make a list of them and even replace the file with a new version. Not sure how to get started.

    Thanks

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

    Re: Search Network (Access 2000 VBA)

    See list of network computers. The sample code in the first reply populates a list box, but it can easily be adapted to fill a table in a database, by opening a DAO or ADO recordset and adding a record for each item found.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Search Network (Access 2000 VBA)

    Thanks, I can't see where to add only computers with the file C:LimsFuels Lube LIMS.mdb.

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

    Re: Search Network (Access 2000 VBA)

    Sorry, I hadn't understood exactly what you want (your original question wasn't entirely clear to me, and I guessed at a possible interpretation, and guessed wrong, as it turns out).

    I'm afraid I don't know how to do that, I don't even know if it is possible. Sorry. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

  5. #5
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Jeddah, Saudi Arabia
    Posts
    243
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Search Network (Access 2000 VBA)

    This works for me in Excel 2003 with our standard Windows Server based network.

    Take the code from the website that Hans sent you the link to and add the following af the end:

    Private Function FileOnServer(Server As String, FileName As String, ByRef message As String)

    message = vbNullString
    Dim FullFileName As String

    FullFileName = "" & Server & "" & FileName

    Dim f As String

    f = vbNullString

    On Error GoTo DirError
    f = Dir(FullFileName)

    If f = vbNullString Then
    FileOnServer = False
    Else
    FileOnServer = True
    End If

    Exit Function

    DirError:
    message = Err.Description
    FileOnServer = False
    Exit Function
    End Function

    Then replace the line

    ListBox1.AddItem GetPointerToByteStringW(se100.sv100_name)

    with

    If FileOnServer(GetPointerToByteStringW(se100.sv100_n ame), "C$LimsFuels Lube LIMS.mdb", message) Then
    ListBox1.AddItem GetPointerToByteStringW(se100.sv100_name) & " found"
    Else
    ListBox1.AddItem GetPointerToByteStringW(se100.sv100_name) & " " & message
    End If
    DoEvents

    Note the change of the colon ([img]/forums/images/smilies/smile.gif[/img] to dollar($) in the file name. This is bacause the default share on a server, or any windows PC for that matter (I don't know about Vista) is designated with a dollar instead of a colon after the drive letter.

    This code will only run of course if you have the correct access permissions and will take some time if you have a large network. You might want to think about using the flags mentioned in the code to limit the types of servers you return from the API calls.

    I hope this helps.

    Regards,
    Kevin Bell

Posting Permissions

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