Pavan Elthepu
Pavan Elthepu

Reputation: 109

MS Access: Allow user to update data from form, but not from table

I want to allow user to update data from form, but not from direct table. I added Before Change event on table, and raising error if the user group is 'basic'. This is working as expected if I enter data in table. But, it is also raising error even if saving data from form. Can anyone help me to resolve this issue?

Thanks in advance!

Upvotes: 0

Views: 1558

Answers (1)

Rominus
Rominus

Reputation: 1221

In general the way to deal with permissions in Access is to only ever show your users the forms; they should never directly interact with a table or query. So instead of adding Before Change code to your table, you instead want to hide the table.

The things you need are in the Current Database section of the Access options. For this example I'll assume you just have the one form, but the same applies if you have many forms and a "Home" form.

  1. Use the "Display Form" dropdown to select the form you want the user to see when they open the application.
  2. Un-check "Use Access Special Keys" to prevent keyboard shortcuts showing objects you don't want shown.
  3. Un-check "Display Navigation Pane" to hide the object list.
  4. Un-check "Allow Full Menus" to prevent users from creating new objects (or use other database development functions)

With this done, the user will see only the form interface you selected and the basic data entry toolbar.

Note that when you want to make changes to the file as a developer you must hold down Shift when opening the application, which will display the navigation pane etc. Of course, any user who knows about the Shift override could do the same. Which is why distributing in a compiled accde, which cannot be unlocked, is a good idea. But you need to set up the application using the above options before that matters.

Upvotes: 1

Related Questions