Getting machine name when connecting to db

P

Paul Fenton

We have an application in Access 2000, front end/back end design,
10-12 users. I want to save the dates and times they enter and exit
from the app from their workstations in a table in the back end.

How do I get the name of their workstation to save to that table? The
workstations have names like "sales1", "sales2", "Reception", etc.


Paul Fenton
 
S

storrboy

Add error handling as required. Place in a module and call function
when needed.


'example by Donavon Kuhn ([email protected])
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
Private Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function GetMachineName() As String
Dim dwLen As Long
Dim strString As String
'Create a buffer
dwLen = MAX_COMPUTERNAME_LENGTH + 1
strString = String(dwLen, "X")
'Get the computer name
GetComputerName strString, dwLen
'get only the actual data
GetMachineName = Left(strString, dwLen)
End Sub
 
T

Todos Menos [MSFT]

SUSER_SNAME() works great in Access Data Projects

then you can practice SafeSex and you don't cut and paste the first
random API call that joe nobody feeds to you


-Todos
 
T

Tony Toews [MVP]

Todos Menos is not a Microsoft employee. This posting is by A a r o n
K e m p f.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
M

Mike Labosh

then you can practice SafeSex and you don't cut and paste the first
random API call that joe nobody feeds to you

ROFLMAO! I know that user. He used to hang out in the old VB6 groups.
--

Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com

"Escriba coda ergo sum." -- vbSensei
 

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

Top