PC Review


Reply
Thread Tools Rate Thread

How Do I do this one..code to run macro if event doesnt happen

 
 
Zach
Guest
Posts: n/a
 
      13th Sep 2003
I have been tasked to work on a database that has
sensitive and confidential information inside. The
database will be backed up to CD and the upgrades to the
database will also be made via CD.

The database uses user level security with me as the Admin.
I need some way to say that if I dont log in, or open a
form, or click on a control, say at least once a month or
week, then a macro will run and delete all the tables with
the sensitive data.
This will ensure that the data wont last long outside of
the groups control. No one inside the group will know
about this feature, to ensure security. It needs to be
inside the actual database in case the program is copied.

I was told to link the log into a table and have a query
compare my log in date to a point in the future and if
there is a null entry before that date then the macro
would run.
I have no idea where to start with this or how to get into
the log in date or even the VB code to do it...

Any help is greatly appreciated.

Zach
 
Reply With Quote
 
 
 
 
Wayne Morgan
Guest
Posts: n/a
 
      13th Sep 2003
You would have to keep track of when you are logged on in a table and check that table
every time anyone opens the database. It could be in the Open event of your startup form.

Now, for the problem. If someone is trying to hack your database, there is no guarantee
that they will open it in the usual way, thereby bypassing your delete routine. The data
can be gotten to using a variety of methods, especially if you assume that if they have
access to get a copy of the file then they probably have access to get a copy of the
workgroup file as well. Also, deleting the data doesn't remove it from the file until the
file is compacted. There are some recovery places that can recover deleted data.

--
Wayne Morgan
Microsoft Access MVP


"Zach" <(E-Mail Removed)> wrote in message news:06ee01c37992$18fc7450$(E-Mail Removed)...
> I have been tasked to work on a database that has
> sensitive and confidential information inside. The
> database will be backed up to CD and the upgrades to the
> database will also be made via CD.
>
> The database uses user level security with me as the Admin.
> I need some way to say that if I dont log in, or open a
> form, or click on a control, say at least once a month or
> week, then a macro will run and delete all the tables with
> the sensitive data.
> This will ensure that the data wont last long outside of
> the groups control. No one inside the group will know
> about this feature, to ensure security. It needs to be
> inside the actual database in case the program is copied.
>
> I was told to link the log into a table and have a query
> compare my log in date to a point in the future and if
> there is a null entry before that date then the macro
> would run.
> I have no idea where to start with this or how to get into
> the log in date or even the VB code to do it...
>
> Any help is greatly appreciated.
>
> Zach



 
Reply With Quote
 
zach
Guest
Posts: n/a
 
      13th Sep 2003
so is there any way to do this? I dont really have to
worry about hackers as much as the information being
copied and used by someone else. If I choose compact on
close, that would take care of the deleting the info,
right? Most of the users have little or no access
training. The information is just of a sensitive nature
that my bosses want to ensure that its secured in any
event, and automatically deleted if necessary. The macro
is already there to dump the system if needed, so they
want a auto dump too.

Any ideas

Zach
 
Reply With Quote
 
Wayne Morgan
Guest
Posts: n/a
 
      13th Sep 2003
Yes, it can be done and the compact on close would help.

You will need the following in the OnOpen event of your initial form.

You would need to get the logged on user name and if it is you, update a field in a table
that you have just for this. It will be a table with just the one field and one value, the
last date you logged on.

You would then check this date and if it is older than a certain date you would delete the
data, set the compact on close property, and close the database.

To get the currently logged on user:
strUser = CurrentUser

To delete data:
Set db = CurrentDb
db.Execute "Delete * From TableName;"
'More tables here
Set db= Nothing

Run the execute statement for each table you want to delete data from. If you have
referential integrity set up you will need to delete from the many table before you delete
from the table on the one side of the link or set up cascade deletes (dangerous).

To set the compact on close:
Application.SetOption "Auto Compact", True

To close the database:
Application.Quit

--
Wayne Morgan
Microsoft Access MVP


"zach" <(E-Mail Removed)> wrote in message news:1fed01c379b8$3b92b6c0$(E-Mail Removed)...
> so is there any way to do this? I dont really have to
> worry about hackers as much as the information being
> copied and used by someone else. If I choose compact on
> close, that would take care of the deleting the info,
> right? Most of the users have little or no access
> training. The information is just of a sensitive nature
> that my bosses want to ensure that its secured in any
> event, and automatically deleted if necessary. The macro
> is already there to dump the system if needed, so they
> want a auto dump too.
>
> Any ideas
>
> Zach



 
Reply With Quote
 
Zach
Guest
Posts: n/a
 
      14th Sep 2003
Ok I added the strUser to the on open to a form that I
only use. I can read VB, but I dont know enough yet to
write anything like this. Ive created a table called Log
with a field called log in, using Date/Time, and input
mask for short date.
How Do I write the code to put my log in on open to this
table and the code to compare it to a future date that
keeps changing? Thank you for your help
-Zach
>-----Original Message-----
>Yes, it can be done and the compact on close would help.
>
>You will need the following in the OnOpen event of your

initial form.
>
>You would need to get the logged on user name and if it

is you, update a field in a table
>that you have just for this. It will be a table with just

the one field and one value, the
>last date you logged on.
>
>You would then check this date and if it is older than a

certain date you would delete the
>data, set the compact on close property, and close the

database.
>
>To get the currently logged on user:
>strUser = CurrentUser
>
>To delete data:
>Set db = CurrentDb
>db.Execute "Delete * From TableName;"
>'More tables here
>Set db= Nothing
>
>Run the execute statement for each table you want to

delete data from. If you have
>referential integrity set up you will need to delete from

the many table before you delete
>from the table on the one side of the link or set up

cascade deletes (dangerous).
>
>To set the compact on close:
>Application.SetOption "Auto Compact", True
>
>To close the database:
>Application.Quit
>
>--
>Wayne Morgan
>Microsoft Access MVP
>
>
>"zach" <(E-Mail Removed)> wrote in message news:1fed01c379b8

$3b92b6c0$(E-Mail Removed)...
>> so is there any way to do this? I dont really have to
>> worry about hackers as much as the information being
>> copied and used by someone else. If I choose compact on
>> close, that would take care of the deleting the info,
>> right? Most of the users have little or no access
>> training. The information is just of a sensitive nature
>> that my bosses want to ensure that its secured in any
>> event, and automatically deleted if necessary. The macro
>> is already there to dump the system if needed, so they
>> want a auto dump too.
>>
>> Any ideas
>>
>> Zach

>
>
>.
>

 
Reply With Quote
 
Wayne Morgan
Guest
Posts: n/a
 
      15th Sep 2003
Ok, the following will use DAO, so if you don't have the reference set, you will need to
set it. To do so, open a code window (Alt+F11) and go to Tools|References. There should be
a check next to Microsoft DAO 3.6 Object Library. If you are using Access 97 or older,
this should already be set, but the version will be older than 3.6.

You will need to manually place an initial date in the table.

In the OnOpen event of the form you created:

Dim db As DAO.Database, strUser As String
Dim dteDate As Date
Set db = CurrentDb
strUser = CurrentUser
If strUser = "Admin" Then 'or whatever your login is
db.Execute "UPDATE Log SET Log.[Log In] = Date();", dbFailOnError
End If
dteDate = DLookup("[Log In]", "Log")
If DateDiff("d", dteDate, Date) > 30 Then 'pick your number of days here
db.Execute "DELETE * FROM TableName;"
'Do this for each table you want to delete data from
End If
Set db=Nothing
Application.SetOption "Auto Compact", True
Application.Quit


This is untested, but should be close enough to get you going.

--
Wayne Morgan
Microsoft Access MVP


"Zach" <(E-Mail Removed)> wrote in message news:02ef01c37a56$5144def0$(E-Mail Removed)...
> Ok I added the strUser to the on open to a form that I
> only use. I can read VB, but I dont know enough yet to
> write anything like this. Ive created a table called Log
> with a field called log in, using Date/Time, and input
> mask for short date.
> How Do I write the code to put my log in on open to this
> table and the code to compare it to a future date that
> keeps changing? Thank you for your help
> -Zach



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
my code doesnt execute to the end of the function, and doesnt return any error... Milsnips Microsoft Dot NET Compact Framework 3 17th Nov 2006 06:10 PM
macro and code in the same event =?Utf-8?B?bmVlcmFq?= Microsoft Access Macros 1 21st Dec 2005 04:00 PM
Run a macro and code from the same event? Tom K via AccessMonster.com Microsoft Access Forms 11 13th Nov 2005 02:29 AM
How to make it happen Windows Control's Event in Code? Jonathan Woods Microsoft C# .NET 2 12th May 2005 02:30 PM
macro code doesnt work in command button The Grinch Microsoft Excel Programming 4 22nd Jul 2004 06:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:44 PM.