Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function getPCname() As String
getPCname = Environ("ComputerName")
End Function
Option Compare Database
'
' Retrieve the current ComputerName.
'
Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSMachineName() As String
'Returns the computername
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
fOSMachineName = Left$(strCompName, lngLen)
Else
fOSMachineName = ""
End If
End Function
'******************** Code End **************************
Option Compare Database
'
' Retrieve the UserName with which the user is logged into
' the network.
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
SELECT fOSMachineName() AS CompName, tblMyTable.*
FROM tblMyTable;
SELECT [TA-Master_Prg_Data].Contact_Name, fOSUserName() AS Expr2
FROM [TA-Master_Prg_Data];
SELECT [TA-Master_Prg_Data].Contact_Name, fOSMachineName() AS Expr3
FROM [TA-Master_Prg_Data];