Identify Unique Thin Client In Access with VB

Posted on 2013-01-16
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

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.
Question by:Scamquist
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

Accepted Solution

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

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


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
LVL 120

Expert Comment

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

Author Comment

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.


Author Closing Comment

ID: 38783618
Quick and Easy...


Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

732 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