Block copy with query result

G

Gordon

I am trying to block Ctrl-C copy, Insert, Delete etc.. for data in my
database application. I have successfuly blocked copying, deleting, inserting
etc when data is displayed in a form or a report but have not been able to
figure out how to do this when it is displayed in a query result page.

Any ideas are welcome, I want to prevent the user from being able to change
the data, copy or print it when displayed in a query result.

Thanks,
Gordon
 
J

Joan Wild

Gordon said:
I am trying to block Ctrl-C copy, Insert, Delete etc.. for data in my
database application. I have successfuly blocked copying, deleting,
inserting
etc when data is displayed in a form or a report but have not been able to
figure out how to do this when it is displayed in a query result page.

Any ideas are welcome, I want to prevent the user from being able to
change
the data, copy or print it when displayed in a query result.


I don't believe you can prevent copying (and am curious how you managed to
do so in a form). However you can hide the database window so users can't
even get to the queries to open any. Create your own custom toolbars/menus
that restrict what they can do. Look at the settings in Tools, Startup for
other things to hide. You'll also want to disable the shiftkey bypass. See
http://www.mvps.org/access/modules/mdl0011.htm
and
http://www.mvps.org/access/general/gen0040.htm
 
G

Gordon

I have blocked Ctrl-C and other keystrokes for forms and reports, How can I
do this for a query result that is displayed. I used the Form_KeyDown event
on the forms, and set properties for the reports, I've even turned things off
using the auto-keys macro. I need to allow, disallow copy dynamically based
on user rights to the data but have not been able to find a way to set the
"properties" or run code associated with a query result. I also need to be
sure users can't delete, insert or change data from a query result.

There are querydef configs in the querydefs collection, but they are
relative to the query itself, the not result set and window of data returned.
I don't even know what to call the query result screen, its not a report,
query, form or table.

Help would really be appreciated.

Gordon
 
J

Joan Wild

Gordon said:
I have blocked Ctrl-C and other keystrokes for forms and reports, How can I
do this for a query result that is displayed.

Simple answer is that you can't; a query has no events you can hook into.
I also need to be
sure users can't delete, insert or change data from a query result.

If you've implemented security, then you can deny them delete/insert/update
permissions on the query.

Again I ask, why are users even seeing any queries. You should restrict the
frontend more by allowing data interaction only through forms and reports.
Create your own toolbars/menubars to restrict what they can do, and change
the settings in Tools, startup so they can't get to the database window.
Set a startup form.
 
P

Paul Overway

If you're really this concerned about not allowing them to copy, you should
display a form or a report instead of a query. But realistically, if you
have given permissions to read the data....users can do whatever they want
with it. You might be making it a little more difficult, but they can still
do it. Sounds like a big waste of time to me.
 
G

Gordon

The reason for the query is that users download a subset of a sql data
database, we control how long they can look at it via a license server (its
encrypted until access tables are populated), and what they can do with the
data view, print, copy - it just the way it is. The idea for them to bring
the data into Access was so that they could then create their own more
detailed queries of the data they were approved to download and analyze. A
user can then create a query to get the subset of the data they have and then
create and run reports off of that. Users have no access to the original sql
database, only to the subset they download, and then only through reports and
queries they generate, everything is locked down, no export, no save as
etc...

You say I can prevent delete, insert, and changing data from/in the query,
but the queries are dynamic and created by the user, how do I set the query
attributes to do this once the query is done? Is the a parameter of a
querydef? If I know how to reference the query and turn these properties off
I can do it but I am having a problem finding how to turn them off (I found
it with tables but not queries)

Thanks again -
 
G

Gordon

Paul,
Thanks, I understand the concept of its not worth it, w/o going into
details, its needed.

Yes, it is a process of making it more difficult.

Any ideas on how to set parameters for a query to turn off insert, delete,
modify and/or run code when a query result is returned to allow turning off
Ctrl-c (such as keydown event) and other keystrokes and functions is
appreciated.

Do you know how you reference a query result that is displayed? Its not a
form, report or table.

Thanks.
 
P

Paul Overway

You control insert/update/delete at the table level with user level
security. As for preventing them from copying the results of a query....you
can't. Impossible. Hence, my previous suggestion to use a form or report
to display the results instead of a query.

As far as referencing a query that is displayed, see Screen.ActiveDatasheet.
 
T

TC

Gordon, it is a little-known fact that query datsheets *do* expose
methods & properties that you can use for various purposes. The methods
& properties are similar to those of a form.

Here is what I said in a thread entitled: "If query returns no records
display messagebox", dated November 2003:

" OpenQuery seems to select the datasheet (empty or otherwise) as the
current object, although this is not doc'd anywhere (AFAICS). Thus,
screen.activedatasheet will refer to the opened datasheet. The methods
& props of that object, look very much like those of a form. In fact,
in the object browser, the datasheet object is defined "As Form" (if I
remember correctly - I don't have Access here to check). In
particular, screen.activedatasheet has a recordsetclone property,
which works exactly as expected. So you can use that property to
determine whether the opened datasheet, does or does not have any
records. "

See if the datasheet props include OnKeyPress, or somesuch. If so,
there /might/ be some way you could finagle a keypress event into the
datasheet. Not sure - cos haven't tried.

If that doesn't work, could you use an AutoKeys macro?

HTH,
TC
 
G

Gordon

TC,
Thanks for the lead, I will look into that. "Little-known fact" - boy that
is an understement, I've searched the internet for days and neither of my
Access programming books mentioned query results were displayed in datasheets.

Thanks, I hope I can make that work.

Gordon
 
J

Joan Wild

Gordon said:
You say I can prevent delete, insert, and changing data from/in the query,
but the queries are dynamic and created by the user, how do I set the
query
attributes to do this once the query is done?

Sorry, but you can't. In your scenario, the users create the query, and
therefore own it. You can't prevent the owner from copying data.
 

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

Top