Restricting Editing of records

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

I have a table and form that records the username that entered the record
via the currentuser() function.

I would like all user to be able to add records, but only allow the user
that entered the original record to be able to edit it.

Is there an easy way to set a form such that the record can only be edited
if the currentuser() matches the ID that is saved in the record?

Tanks

Joe
 
Use the OnCurrent Event on the form

create a new function with the following code

Public Function CheckUserName
Call CurrentUser()
if forms![frmname]![usernamefield] = uservariable1 then
forms!frmname.AllowEdits = true
else
forms!frmName.AllowEdits = false
end if
End Function

and then on the OnCurrent Event on the form Call CurrentUser
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top