Code to find Database install directory

mafhobb

Registered User.
Local time
Today, 14:54
Joined
Feb 28, 2006
Messages
1,249
What would be the code to find the install directory of a database from within the opened database?

Say the "welcome" form loads up and a msgbox opens listing the install dir?

Thanks

mafhobb
 
currentdb.name

Is that what your looking for??

Or if you want only the path...
left(currentdb.Name, len(currentdb.Name) - len (dir(currentdb.Name)))
 
Yes, that is what I needed.

Do you know if code like this can be added to the BE to check for install dir if someone double-clicks on the BE directly?

mafhobb
 
Currentdb only can check on the current db... not any other db...
 
Sorry, I did not explain myself well.

I mean for the BE to check its own install dir when it is opened up.

mafhobb
 
So...I am new to Split dbs and I am planning to split this one.

It was my understanding that the split BE can only have tables with values. Is that not the case?

How does this form you are suggesting interact with a FE since it is not in the FE, but the BE? Would it open every time anyone uses the FE to look for data (or add or edit) to the BE?

mafhobb
 
Front end contains your forms, queries, reports, macros, modules and VB code.
Back end only has tables. Tables store the data.

When you split a db, you are creating 2 files. Both are Access databases. You the tell the FE where the tables are to be found. This is called linked tables. Once a table is linked, the FE "sees" them as being part of the FE rather than another file.

The BE could also be made up of more than one file.
 
OK, let's see if I get this.

1) I can create a db and split it into a FE and BE. (done)
2) I link the tables between the FE and BE. (done)
3) I can now add a form to the BE to perform some tasks, but these are only going to happen IFF the BE is being opened on its own as the FE simply sees the linked tables and nothing else.

Is this correct?

mafhobb
 
All correct.

3) I can now add a form to the BE to perform some tasks, but these are only going to happen IFF the BE is being opened on its own as the FE simply sees the linked tables and nothing else.

Rather create a new FE with the forms that "perform some tasks" and link that to the BE. Or even have a secured Admin section in your FE.
 
What I do for my BEs is to make a sub folder \Database

In this subfolder I stick my BEs thus 'hidden' from the naked eye of the user who simply shouldnt go in there...

Then I have a form "on open" of the BE database that simply says "GET OUT", "BAD USER", "PISS OFF" or something a little nicer but along simular lines ;)
and then upon "OK" of said user, closed the db
 
Dairy Farmer,

The BE will be protected by using Access security (users, groups and permissions). I only have 2003 now but hopefully I'll have 2007 in the near future, which means I will also encrypt the BE. The "Check the path" is just another (small) piece of added security in case someone copies the BE and takes it home.

Every little bit helps!

mafhobb
 

Users who are viewing this thread

Back
Top Bottom