Exporting Table Automatically to Another Database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

Is it possible to export a table to another database automatically, say...in
an onclose or onexit event of the source database??

If so, how would I go about doing this?

Thank you!
MN
 
Would this be easier than taking a single database, and assigning permissions
to it? I.e. One permission for a group of people would be read only, and
then the other group would be read/write? I've tried to utilize permissions
in Access before, but seemed cumbersome.

Thanks,
MN
 
It is cumbersome.
If you control your application property so that users have access only
through your forms and you deploy only mde front ends, you can use your own
security.
Create a user table and assign rights be user level or by specific
functions, then put code in your forms to restrict functionality based on
those rights, you can pretty much prevent the normal user from getting to the
tables. You can also put a password on your back end mdb, but again, it will
only protect against the normal user. If you get someone who know Access
well, they can get past any security you impose. You would not believe how
many password crackers you can download from the web.
 
How would I go about creating this user table and assigning rights by user
level or specific functions? I want one user for read, and one user for
read/write and maybe one for admin? What would be my next step?

Thanks a lot!
MN
 
Start by creating a table with fields for the user's name and their Windows
login name and some code that defines their rights.

You can use this code to find the user's Windows login name:

***************************************
Private Declare Function GetUserNameA Lib "Advapi32" (ByVal strN As String,
ByRef intN As Long) As Long
Public Function GetUserID()
Dim Buffer As String * 10
Dim Length As Long
Dim lngResult As Long, UserId As String

Length = 10
lngResult = GetUserNameA(Buffer, Length)
GetUserID = Left(Buffer, Length - 1)
End Function
********************************
Put the code in a standard module

Then just write the code in the Load event of your form's to dermine who is
logged on ans what their rights are. The set the properties of the form
objects to allow the users only the rights they have. For example, if you
want the user to be read only, set all the controls to .Enabled = False and
..Locked = True
They can the look at stuff, but can't change it.
 
Awesome -- thank you!

If you have the code in the module to determine who is logged on...and you
can define their rights in the forms (or do you do that in the module?) then
what is the purpose of the table?

At any rate, I have created a table containing UserID and UserName.
Also...i put that "GetUserNameA" code in a module.

Thank you again!
MN
 
You do need the table. Forms don't retain any data. You could hard code
each user and their rights into the form's module, but you should not do
that. Users come and go. It makes no sense to hard code data you know you
will eventually have to change.
The correct technique is to have the data in the field. Use the function to
determine who is logged on, then use a Dlookup to determine the rights of the
logged on user.
 
I see...but are their rights located in that table that contains their name
and userid then? if so...how do I assign rights there or are they assigned
somewhere else?

Thanks!
 
The user rights should be stored in the table. You will probably need a form
to enter information for the users.
Use the form's load event to find the user's rights and enable and disable
controls as necessary to enforce the security.
 
Ok...please let me know if this is correct:

I have users IDs and user rights stored in a table.
I have the module to get the current user ID
In each forms' onload event...i call the module.
then, i have a dblookup function to look up user rights based on that user ID.
THen I have a series of IF statements to restrict security based on what you
had mentioned about locking and everything.

Is this correct?
 
--
Dave Hargis, Microsoft Access MVP


MacNut2004 said:
Ok...please let me know if this is correct:

I have users IDs and user rights stored in a table. Correct

I have the module to get the current user ID
In each forms' onload event...i call the module.
You don't call a module, you call a function in the module. Be sure they do
not have the same name. That will cause an error.
 
Back
Top