Tracking Changes in a Data Access Page

J

John Crerar

Hello,

I have to create a series of data access pages to collect data to
populate a series of tables in a singe database. I need to record the
date/time that changes are made to any records, and an Employee ID# of the
person who made the changes. I had set up a form that acheived this nicely,
but I cannot figure out how to do the same thing in a DAP. The form allowed
users to enter any data, then when before update the timestamp filed was
automatically fiiled in, and the user was prompted to enter an employee ID #
which had to match a number in the apporpriate table. Is there any way to
transfer this functionality to a DAP?

Thanks
 
J

JA Peachrose

I dont know how to answer your question but did want to share my coding for
getting the computer user's name instead of having the user key their
employee #.....
You will need to setup a table with employees name, computer name, employee
number, etc and then add the following code to a module and call it when
logging onto the program.

Function GetUser() As String
'USERIDLEN = 25
Dim defUserID As String * 25
Dim userid As String
Dim ComName As String
Const MAX_COMPUTERNAME_LENGTH = 15
Dim nRet As Long
Dim i As Integer
Dim dl&
Dim sz& 'Test
Dim s$

s$ = String$(MAX_COMPUTERNAME_LENGTH + 1, 0)
sz& = MAX_COMPUTERNAME_LENGTH + 1
dl& = GetComputerName(s$, sz)
If dl& = 1 Then
i = InStr(s$, Chr$(0))
If i > 1 Then
ComName = Left$(s$, i - 1)
Else
ComName = s$
End If
End If

' Get the ID of the currently logged in user from the OS
nRet = GetUserName(defUserID, 25)
If nRet = 1 Then
' Trim off any trailing nulls, to get just the text part of the string
i = InStr(defUserID, Chr$(0))
If i > 1 Then
userid = Left$(defUserID, i - 1)
GetUser = Left$(defUserID, i - 1)
Else
userid = defUserID
GetUser = defUserID
End If
End If

End Function
 
J

John Crerar

I'll have to look into how the user names are set up for everybody who will
be using this. That might work. I still need to figure out how to get a
timestamp from a data access page. This was pretty easy for the form, but I
am really unfamiliar with how DAP's work.
 
Top