If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Storing machine-specific information

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-11-12, 04:59
CeejayDBF CeejayDBF is offline
Registered User
 
Join Date: Mar 2010
Posts: 84
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.
Reply With Quote
  #2 (permalink)  
Old 02-11-12, 05:20
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
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!
Reply With Quote
  #3 (permalink)  
Old 02-11-12, 05:29
CeejayDBF CeejayDBF is offline
Registered User
 
Join Date: Mar 2010
Posts: 84
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?
Reply With Quote
  #4 (permalink)  
Old 02-11-12, 05:43
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
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!
Reply With Quote
  #5 (permalink)  
Old 02-11-12, 05:48
CeejayDBF CeejayDBF is offline
Registered User
 
Join Date: Mar 2010
Posts: 84
thanks

CJDBF
Reply With Quote
  #6 (permalink)  
Old 02-11-12, 06:00
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
You're welcome!
__________________
Have a nice day!
Reply With Quote
  #7 (permalink)  
Old 02-11-12, 09:05
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On