I've been using the same code in my database for probably 8-10 months. Today I get an error. Any idea on where to even begin troubleshooting?
Here's the code:
General - Declarations
Public Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function fOSUserName() As String
Dim LngLen As Long, IngX As Long
Dim struserName As String
struserName = String$(254, 0)
IngLen = 255
IngX = apiGetUserName(struserName, IngLen)
If (IngX > 0) Then
fOSUserName = Left$(struserName, IngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
Private Sub Notes_Dirty(Cancel As Integer)
Enteredby.Value = fOSUserName
Date.Value = Now()
End Sub
Seems super simple, right?
Now out of the blue when someone enters text in the Notes field I get "The expression On Dirty you entered as the event property setting produced the following error: Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object models."
Please help. Thanks.
Here's the code:
General - Declarations
Public Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function fOSUserName() As String
Dim LngLen As Long, IngX As Long
Dim struserName As String
struserName = String$(254, 0)
IngLen = 255
IngX = apiGetUserName(struserName, IngLen)
If (IngX > 0) Then
fOSUserName = Left$(struserName, IngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
Private Sub Notes_Dirty(Cancel As Integer)
Enteredby.Value = fOSUserName
Date.Value = Now()
End Sub
Seems super simple, right?
Now out of the blue when someone enters text in the Notes field I get "The expression On Dirty you entered as the event property setting produced the following error: Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object models."
Please help. Thanks.
Last edited: