Prevent Deleting Records

  • Thread starter Thread starter ChuckL
  • Start date Start date
C

ChuckL

I am providing my users with the capability of pushing a
button (macro) on a form that runs a select query and
displays the query result in datasheet view. The problem
is that they are able to delete records from the table
upon which the query is based simply by selecting a row
and pressing the delete key.
Is there a way that I can maintain my table integrity by
not allowing my users to delete records via the query
results?

Thank you very much for your help!
 
I am providing my users with the capability of pushing a
button (macro) on a form that runs a select query and
displays the query result in datasheet view. The problem
is that they are able to delete records from the table
upon which the query is based simply by selecting a row
and pressing the delete key.
Is there a way that I can maintain my table integrity by
not allowing my users to delete records via the query
results?

Thank you very much for your help!

Set the Query's Snapshot property to True... or, probably better,
don't ever display table or query datasheets period; instead, open a
Form to display the data (and set the form's Allow Deletes and Allow
Edits and Allow Additions properties to FALSE).
 
Here are three options:

1) Use a continuous form to display the results and set it to not allow deletes,
updates, etc.

2) Use VBA to open the query and set the datamode to readonly
DoCmd.OpenQuery "YourQueryName", , acReadOnly

3) Set the Option Data Mode to Read only in the Macro
 
Back
Top