Hi Guys
I've just realised that i can set the date a record is created using the Default Value property on a table, by setting it to NOW()..
Now, I was wondering is it possible to capture the username of who created the record? I've always used this function when writing records to a db using recordsets..
I tried setting the default value of a text field to fnOSUserName().. failed..
Is there any way of doing this? Or is this more in the realms of SQL Server.. given that access is just a file.
I've just realised that i can set the date a record is created using the Default Value property on a table, by setting it to NOW()..
Now, I was wondering is it possible to capture the username of who created the record? I've always used this function when writing records to a db using recordsets..
Code:
Public Function fnOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngx As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngx = apiGetUserName(strUserName, lngLen)
If (lngx > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
I tried setting the default value of a text field to fnOSUserName().. failed..
Is there any way of doing this? Or is this more in the realms of SQL Server.. given that access is just a file.
Last edited: