Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2010
    Posts
    88

    Unanswered: Storing machine-specific information

    I have an application (Access 2007) which involves a number of computers accessing a common backend data file via a Windows share. Nearly all of the data is common to all, and is therefore in the backend file.

    However, there are a few bits of information which are computer-specific (such as the location of external file paths when exporting data), and I have been storing these in a local table inside the front end.

    This is fine, except when it comes to doing an upgrade, when its a real pain. If I distribute a new front-end, the local data is all lost and has to be recreated.

    I'm now thinking of changing this so that machine-specific information is stored in a backend table, with one record per machine. I have a function already to look up ComputerName, so was thinking of just using that to index into the table.

    I'd need to have code on startup to check to see if this machine already exists in the table, and if not then create a new record with sensible defaults.

    Are there any drawbacks I haven't thought of?

    Can I rely on Windows (XP, Vista or 7) to insist that every machine has a ComputerName and to flag to users if there is a duplicate on the network? There are several separate installations of this application, and they are all (AFAIK) running on small "home" networks - no Active Directories anywhere.

    Thoughts from an experienced hand would be welcome.

    TIA.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You can always retrieve the name of the computer:
    Code:
    Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    
    Public Function GetNTComputer() As String
    
    '
    ' Retrieve the name of the computer
    '
        Dim strComputerName As String
        Dim lngComputerNameSize As Long
        
        strComputerName = String$(255, 0)
        lngComputerNameSize = Len(strComputerName)
        GetComputerName strComputerName, lngComputerNameSize
        strComputerName = Left$(strComputerName, lngComputerNameSize)
        GetNTComputer = strComputerName
    
    End Function
    Have a nice day!

  3. #3
    Join Date
    Mar 2010
    Posts
    88
    Thanks, I knew that! As I said, I already have a function which returns ComputerName.

    My questions were about whether my approach is sensible - is ComputerName always a reliable key?

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    As far as there cannot be 2 computers with the same name in the same domain (by construction in Windows NT and beyond), yes it is.
    Have a nice day!

  5. #5
    Join Date
    Mar 2010
    Posts
    88
    thanks

    CJDBF

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    anoither approach would be to set up a local ini file or equivalent storing such data.
    or make the destination for export files as a common URL path
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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