Only the creator can edit record

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

Guest

I have developed an access application for the medical field (with much help
form this group, Thanks!) I have forms where nurses and doctors are able to
choose from a picklist of brief blurbs, i.e. Patient presents to clinic today
in acute distress. The blurge is then added to a table and is visible and
editable via a form.

What I need to do is make it so that only the creator of the record can edit
the record. To do that I need to record the current user's user name (I'm
using MS Access user level security) and then I need to check if this user
was the creator of the record. If they are the creator then they can edit it,
if not then they cannot edit.

Any help with this would be greatly appreciated. Rob
 
First, you need a field in the table that is the record source for the form
so you will know who created the record. Then create a field on the formI
would name the form control txtCurrentUser and set it to Locked = Yes and
Enabled = No or make it Invisible, whichever suits you best. Set it's Default
Value to =CurrentUser.

Then at the point a user attempts to modify a record, use something like this:
I will use the form's Before Update event as an example:

If CurrentUser <> Me.txtCurrentUser Then
MsgBox "Only the Creator of this record may change it"
Cancel = True
End If
 
Beautiful, Thank You. Rob

Klatuu said:
First, you need a field in the table that is the record source for the form
so you will know who created the record. Then create a field on the formI
would name the form control txtCurrentUser and set it to Locked = Yes and
Enabled = No or make it Invisible, whichever suits you best. Set it's Default
Value to =CurrentUser.

Then at the point a user attempts to modify a record, use something like this:
I will use the form's Before Update event as an example:

If CurrentUser <> Me.txtCurrentUser Then
MsgBox "Only the Creator of this record may change it"
Cancel = True
End If
 
You're going to run afoul of JCAHO with this approach, to say nothing of
malpractise lawyers! In hand written notes, a health care provider cannot
remove a written note and then write another, which is essentially what
you're trying to allow them to do. They have to strike thru the old notes
with a single line and initial it, then write another note in it's place! The
only way to emulate this in online notes is to only allow notes to be emended.
The old text has to remain, with the person adding an additional note stating
something like "Correction to note of thus and such day and time."

The general way that I do this is to make the memo field itself always locked.
I mput a button next to it, call it "ADD a Note." Clicking it brings up a
text box for adding notes. The user enters their notes and DoubleClick the
note field. The note gets added to the old text, along with a date/time stamp
and the user username.

If JCAHO or an attorney comes along, you can show that the use has no means
of changing a previously entered note.

I'm 4+ busy right now, but I'll dig around and post some example back here in
a day or two, if you're interested!
 
In
missinglinq via AccessMonster.com said:
You're going to run afoul of JCAHO with this approach, to say nothing
of malpractise lawyers! In hand written notes, a health care provider
cannot remove a written note and then write another, which is
essentially what you're trying to allow them to do. They have to
strike thru the old notes with a single line and initial it, then
write another note in it's place! The only way to emulate this in
online notes is to only allow notes to be emended. The old text has
to remain, with the person adding an additional note stating
something like "Correction to note of thus and such day and time."

The general way that I do this is to make the memo field itself
always locked. I mput a button next to it, call it "ADD a Note."
Clicking it brings up a text box for adding notes. The user enters
their notes and DoubleClick the note field. The note gets added to
the old text, along with a date/time stamp and the user username.

If JCAHO or an attorney comes along, you can show that the use has no
means of changing a previously entered note.

I'm 4+ busy right now, but I'll dig around and post some example back
here in a day or two, if you're interested!

Well posted, missinglinq!
 
Surely there must be a way to only allow the current new record to be editable;

If Me.NewRecord And Me.CurrentRecord Then
Me.allowedits = True Else
Me.allowedits = False

I've tried this and it doesn't work, Why not?

Thanks, Rob
 
In
RobUCSD said:
Surely there must be a way to only allow the current new record to be
editable;

If Me.NewRecord And Me.CurrentRecord Then
Me.allowedits = True Else
Me.allowedits = False

I've tried this and it doesn't work, Why not?

I think all you need is this:

Me.AllowEdits = Me.NewRecord

Me.CurrentRecord is just the record number of the current record, so
using it in a logical expression like the above makes no sense.
Me.NewRecord always refers to the status of the form's current record.
 
Back
Top