copying data from datasheets

J

John Welch

I have a few subforms that display as datasheets. Is there a way to not
allow users to copy and paste that data into some other program, like Excel?
I imagine the solution will be to use continuous forms rather than
datasheets, but I thought I'd ask to see if it's possible to restrict
datasheets.
thanks
 
T

TC

I suspect you can not stop him doing that with a datasheet.

But why bother trying? A skilled person will always be able to copy
your data out. He can just connect to your running copy of Access, via
automation. He could probably even do it from a simple VBScript
program.

HTH,
TC
 
L

Lynn Trapp

TC is right that a skilled user can probably get around anything you do.
However, you can create an AutoKeys macro and cause the Ctrl+C combination
to pop up a message box that tells the users they cannot copy data from the
database. Then remove the standard menus that allow copying and pasting.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html
 
J

John Welch

Great idea, thanks

Lynn Trapp said:
TC is right that a skilled user can probably get around anything you do.
However, you can create an AutoKeys macro and cause the Ctrl+C combination
to pop up a message box that tells the users they cannot copy data from
the database. Then remove the standard menus that allow copying and
pasting.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html
 
K

Keith

Lynn Trapp said:
you can create an AutoKeys macro and cause the Ctrl+C combination to pop
up a message box that tells the users they cannot copy data from the
database.

Can this be done from code?
 
T

TC

Oops, with one proviso: It's only good if you want to disable ^c
globally, throughout the whole application, in all circumstances.

Say you need to disable it in some places, and not in others. You can
code an appropriate test in the macro, but IIRC, there is no way for
the "false" branch of that test to say: "Oops, I do not need to trap it
this time, just do whatever you would normally do with that keystroke".

TC
 
J

John Welch

Lynn, I took your advice and wrote a function that is called by my autokeys
macro when a user types control-c. Just thought I'd share it will everyone:
It works great, and only allows admins to use control-c

Public Function handleControlC()
On Error Resume Next
If IsUserInGroup("admins",CurrentUser()) Then
DoCmd.RunCommand acCmdCopy
Else
MsgBox "You cannot use 'control-c' for copy at this time."
End If
End Function

'the following function was posted by a kind person on the newsgroups
(sorry, don't remember name now)
Public Function IsUserInGroup(strGroup As String, strUser As String) As
Boolean
Dim s As String
On Error Resume Next
s = DBEngine(0).Users(strUser).Groups(strGroup).Name
IsUserInGroup = (Err.Number = 0)
End Function

-thanks to all
-John
 
T

TC

Agreed. I only use one: an AutoKeys macro to suppress the normal ^F
Find throughout the application. That's because I have a custom Find
function (with a proper button) on each findable screen, & the normal
function is not consistent with my custom one.

Cheers,
TC
 
L

Lynn Trapp

Just wondered, I like to keep my apps macro-free.

You and me both. I hate macros. I wouldn't even use the macro that this guy
wanted. The only macro that I would ever allow into an application is,
possibly, an AutoExec macro that opens an initial form, but that's probalbly
never necessary.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html
 
T

TC

Another use for macros is an autoexec macro to kick of the code to
check if all the references are still defined. This code must be
written extremely carefully, or it too will fail when any references
are undefined. This code definitely can't be in, or started from, a
form; I don't know whether it can or can't be safely started via the
tools:startup options; but it definitely /can/ be safely started via an
autoexec macro.

Cheers,
TC
 

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