Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting Query Allows Deletion of Records 1

Status
Not open for further replies.

swaggel1

Technical User
Jun 19, 2001
34
0
0
US
I have created a secured database in which users are able to click a button and bring up the results of a query. Users can then view this information, can select the records, and can copy them into Excel to create a report with their own formatting, etc.

In setting up the query, I read somewhere that setting "Unique Values" to Yes in the query properties would prevent deletions of records. However, with that set to Yes, it caused the Memo fields of the query to truncate when copying into Excel.

I then found that, when a query is based on tables that are linked, the records cannot be deleted. That was working fine (I created a "dummy" table to link to), until one of our users found that she could right-click in the query results, sort on a field in the query, then delete a record. (Users do not have access to toolbars that allow then to sort.) I know that I can prevent the right-click menu in forms, but I don't know how to turn it off in a query.

For some reason, when the query opens, no records can be deleted, but once a sort on the data is performed, you can delete anything you want.

I know that I can set up a simple macro to export the data directly into Excel, but some users only want to view the information, not create a report. Is there any way I can keep the records in the query locked-down, so that they CANNOT be deleted, no matter what? Thanks!
 
There is a parameter for opening queries to indicate the results are read-only - look at the help for the method you are using. You can also set the query type to Snapshot in the query properties so that regardless of how the query is opened it will be read-only.

Records in a linked table can be deleted in many situations so definitely don't rely on this.

John
 
Thank you! Changing the query properties to Snapshot did exactly what I needed it to do, and it was a very easy fix! Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top