Assign Session Numbers and User IDs

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database that calls for 4 users to review patient medical charts and
record whether or not specific documents are in the chart. What I want to do
is assign a session number and user id to each data entry session. For
example, when the user opens the database, this is what I envision:

1. A random session id is assigned using the AutoNumber>Random setting
2. The user enters their user ID
3. The user chooses a medical record number to review
4. The session number and the user id are assigned to the data entry record
so that
when the data entry is reviewed, I can tell who reviewed and entered the
data
for a particular session/medical record number

Hope that's clearer than mudd.

Thanks.
 
It sounds as if you need a "change table". Every time a record is edited,
you could use code in the AfterUpdate event of the form to write a record to
the change table indicating who, what, when, why, etc. The SessionID could
be an autonumber field in this change table.
 
Thanks. What would this code look like?

Wayne Morgan said:
It sounds as if you need a "change table". Every time a record is edited,
you could use code in the AfterUpdate event of the form to write a record to
the change table indicating who, what, when, why, etc. The SessionID could
be an autonumber field in this change table.
 
You would assign the values to variables then use those in an Append Query
that you built in the code.

Example:
Dim lngID As Long, strUser As String
Dim strSQL As String
lngID = Me.txtRecordID
strUser = CurrentUser
strSQL = "INSERT INTO tblMyChangeTable (RecordID, UserChanging) " & _
"SELECT " & lngID " AS Expr1, " & strUser & " AS Expr2;"
CurrentDb.Execute strSQL, dbFailOnError

You won't need to put in the id of the record for the change table if you've
set the change table's Id field to autonumber, so you'll only need to supply
the other fields (such as the ID of the record being changed and the user
making the change), as desired.
 
Back
Top