Solved

Identify Unique Thin Client In Access with VB

Posted on 2013-01-16
5
503 Views
Last Modified: 2013-01-16
I am trying to use VB in MS Access to find a way to find a unique identifier of a thin client.  I use this to discretely identiry who may have performed a particular action in the database.  In the past, I have used

shell:
Dim objShell: Set objShell = CreateObject("Wscript.Shell")
strPC = objShell.ExpandEnvironmentStrings("%computername%")

on other projects.  However, this returns the name of the server.

Is there a way to find somehting unique to the thin client?  Session ID?  Motherboard serial number.  Thin client serial number?

Any help would be appreciated.
0
Comment
Question by:Scamquist
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 9

Accepted Solution

by:
TazDevil1674 earned 500 total points
ID: 38783180
Change %computername% to %clientname%

strPC = objShell.ExpandEnvironmentStrings("%clientname%")
0
 
LVL 58
ID: 38783233
Why not the user name?

Jim.

Private Declare Function GetComputerNameA Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetUserNameA Lib "advapi32.dll" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function WhoAmI(bReturnUserName As Boolean) As String

        ' Function returns either user name or computer name

        Dim strName As String * 255

10      If bReturnUserName = True Then
20        GetUserNameA strName, Len(strName)
30      Else
40        GetComputerNameA strName, Len(strName)
50      End If

60      WhoAmI = left$(strName, InStr(strName, vbNullChar) - 1)

End Function
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38783267
strClient = objShell.ExpandEnvironmentStrings("%username%")
0
 
LVL 1

Author Comment

by:Scamquist
ID: 38783616
This is on the manufacturing floor and all have the same user name, eproduction.user.  

I have incorporated user name in the past and it works well.


However, TAZ

strPC = objShell.ExpandEnvironmentStrings("%clientname%")

worked like a champ.

Thanks
0
 
LVL 1

Author Closing Comment

by:Scamquist
ID: 38783618
Quick and Easy...

THANK YOU!
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question