Your code sample is incomplete: it's missing the declaration of
apiGetComputerName, which is:
Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
That must be put at the beginning of the same module where you've placed
fOSMachineName.
BTW, that code came from
http://www.mvps.org/access/api/api0009.htm at
"The Access Web". You obviously chose to ignore the copyright information
when you copied it!
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish