I have a database that is supposed to attach the Network user name to the record using an API script when the record is new. However, it does not seem to be working. can anyone give me some help with this?
Public Function StampRecord(frm As Form, Optional bHasInactive As Boolean = False) As Boolean
On Error GoTo Err_StampRecord
'Purpose: Stamp the user and date/time into the record.
'Return: True if successful.
'Argument: frm = the bound form to be stamped.
' bHasInactive= True if the form has Inactive fields.
'Assumes: Fields named EnteredOn, EnteredBy, UpdatedOn, and UpdatedBy.
'Usage: In Form_BeforeUpdate:
' Call StampRecord(Me, True)
Dim strForm As String
Dim strUser As String
If frm.NewRecord Then
frm!EnteredOn = Now()
frm!EnteredBy = strUser
Else
frm!UpdatedOn = Now()
frm!UpdatedBy = strUser
End If
Exit_StampRecord:
Exit Function
Err_StampRecord:
Call LogError(Err.Number, Err.Description, conMod & "StampRecord()", "Form = " & strForm)
Resume Exit_StampRecord
End Function
ok tried replacing str=NetworkUserName() with strUser=environ("UserName") and it didn't work. It acts like the code is either being ignored or is not being triggered.
error 2465 application-defined or Object-defined error when I close the form. does this have something to do with the Call Stamprecord not being triggered?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.