Accessing "Remote" Databases

  • Thread starter Thread starter Kevin S.
  • Start date Start date
K

Kevin S.

Using code, such as below, I have been able to access recordsets from other
databases without linking them in the database window. Really, I'm just
trying to make a separate database which holds user information and I plan
to hide it somewhere.

Dim securityDB As Database
Set securityDB = DBEngine.OpenDatabase("path of the database")
Dim SecurityUsers As Recordset
Set SecurityUsers = securityDB.OpenRecordset("SecurityUsers")
Dim SecurityGroups As Recordset
Set SecurityGroups = securityDB.OpenRecordset("SecurityGroups")

Now, a form normally does well accessing data when a table is set in the
"record source" property. However, I don't think that I can set a remote
table in the record source for a form when the table isn't even linked in
the database window. (Keep in mind I don't want it there either.) My
solution is to open a form that is in the remote (user) database and display
it on the screen using code.

My question: Is it possible though? How can you do it using code? Also, can
I call functions stored in modules when the module is another database? How
do I do it?

Thanks for the help, it is really appreciated!
Kevin Seitz
 
Sounds as if you're trying to re-invent the wheel.
Why not just use Access's built-in security?
 
I suppose I am trying to re-invent the wheel, but the built-in security
won't let you lock out items on forms and etc.
 
Okay, I will trim my question down a little bit.

How can I open a form in another database using code? How can I execute code
from another database? I've seen it done before but it is an .mde file. I do
not want to import the forms or code.

(LASsie, Light Access Security by Peter's Software is my example. The
creator has an MDE database with all the forms and code so the user cannot
edit it, and the frontend database has code which calls other code to open
the forms.)

-Kevin Seitz
 
I'm not exactly sure what you mean by 'lock out items on forms and etc' but,
as far as I'm aware, the built-in security will let you do just about
anything. What are you trying to stop the users seeing?
 
I think the question that you are _actually_ asking is "How do I install an
add-in?" I've only ever done it once so I can't remember exactly how to do
it... but it's something along the lines described here....

http://www.granite.ab.ca/access/addins.htm (Tony Toews' site)

and here...

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q201735

Having said that, from your description of your requirement so far, it
doesn't look to me like the right situation to be using add-ins (the one mda
that I did, btw, was a security utility that could apply to all mdbs I ever
used). Are you sure that the standard Access security model isn't going to
do the job? If security is your _real_ issue, then you need to be upgrading
to SQL. Access on it's own, no matter how complicated you think you're
making it, isn't going to do the job.
 
Not directly, perhaps, but I've had pretty good success checking the user's
group in the form's Load event, and disabling or hiding controls they
shouldn't be able to access.

If you're interested, I could probably whip up some code to share.
 
Back
Top