Private Sub Command2_Click()
'Declare variable
Dim sHostName As String
' Get Host Name / Get Computer Name
sHostName = Environ$("computername")
'Set field name [PCName] to the variable "sHostName "
PCName = sHostName
End Sub
Notes
https://stackoverflow.com/questions/3551055/how-to-get-name-of-the-computer-in-vba