How to determine the name of local computer

  • Thread starter Thread starter Danny
  • Start date Start date
D

Danny

I'd like to track changes to a database by inserting the
computer name (the machine's identity name, e.g., that is
returned as "System Name" via the "Set" command at the DOS
prompt on Windows XP) in any record via the afterupdate
event. How can I retrieve this information?

Thanks in advance.

Danny
 
Public Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Dim buf As String * 1024
Dim bufLen As Long
bufLen = 1024
Call GetComputerName(buf, bufLen)
msgbox Left(buf, bufLen)
 
Phil,

Thank you very much. I just ran this code, and it works great!

Danny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top