ok, I don't know what I was doing wrong but this is what ended up working:

Code:
function ErrorLog($ErrorMsg)
DIM $LogFile,$LogError,$AltLogFile,$error,$serror,$ErrorString

$error = @ERROR
$serror = @SERROR
$ErrorString = "Error $error, $serror, $ErrorMsg, @WKSTA, @USERID, @DATE, @TIME, @CRLF"
$LogFile = "\\server\SoftwarePushes\sms\logging\@MDayNo_@MonthNo_@Year.log"
$AltLogFile = "\\server\SoftwarePushes\sms\logging\@MDayNo_@MonthNo_@Year-@WKSTA.log"
$LogError = OPEN (5,$LogFile,5)

If $LogError=0
$ = WRITELINE(5,$ErrorString)
Else
$ = OPEN (6,$AltLogFile,5)
$ = WRITELINE(6,$ErrorString)
$ = CLOSE (6)
EndIf
$ = CLOSE(5)
endfunction