How to set path for database (.mdb) file ??? 
Author Message
 How to set path for database (.mdb) file ???

OK, here's my problem...

I write a database application using a Access2.0 database (.mdb) file, and
I want the executable and the database together in the same directory.
You should be able to copy the program everywhere, as long the .exe and the
.mdb files are together in the same directory.

The program works fine, but i still had to set in the database properties the
full path for the database file :-(

So, the program should seek the database in the directory in which the program
is ( No fixed path !)

How can i program this ?

All kind of tip or source codes are welcome

Thanks in advance

Guenter Kaiser




Tue, 04 Nov 1997 03:00:00 GMT  
 How to set path for database (.mdb) file ???
Use the function App.Path which will return the path that the .EXE ran
from.  You filename is App.Path + "\MY_5DB.MDB"
Another approach is to allow the user to set the path using common dialog
and set the location in an INI file.  This is nicer since you can have
the DB located anywhere.
Luck....
--
Lance Holland
lholland.csc.com


Tue, 04 Nov 1997 03:00:00 GMT  
 How to set path for database (.mdb) file ???

Quote:

>I write a database application using a Access2.0 database (.mdb) file,  
>and I want the executable and the database together in the same  
>dirrectory.  You should be able to copy the program everywhere, as long  
>the .exe and the .mdb files are together in the same directory.

>The program works fine, but i still had to set in the database  
properties the
>full path for the database file :-(

{SNIP}

Guenter,

This is an example of the code I use in may projects.

In the declarations section of the module where your Sub Main proceedure  
is located, add the following code:

Global gsDatabasePathAndName As String

In the Sub Main Proceedure add the following code:

gsDatabasePathAndName =3D App.Path & "\Currdev.mdb"

Substitute the name of your mdb in the code above, but make sure you  
include the backslash.

Scott Stewart
Phoenix, Arizona
--Please don't flame the Suns.  I'm depressed enough already.



Thu, 06 Nov 1997 03:00:00 GMT  
 How to set path for database (.mdb) file ???

Quote:
>OK, here's my problem...
>I write a database application using a Access2.0 database (.mdb) file, and
>I want the executable and the database together in the same directory.
>You should be able to copy the program everywhere, as long the .exe and the
>.mdb files are together in the same directory.
>The program works fine, but i still had to set in the database properties the
>full path for the database file :-(
>So, the program should seek the database in the directory in which the program
>is ( No fixed path !)

I don't know how to get a completely movable setup for this, but if you set up
 Global Const DBname = "C:\path\database.mdb"
and then in the Form_Load
     datControl.DatabaseName =DBname
then you only need to change the path as required.


Sun, 09 Nov 1997 03:00:00 GMT  
 How to set path for database (.mdb) file ???


Quote:

>>OK, here's my problem...

>>I write a database application using a Access2.0 database (.mdb) file, and
>>I want the executable and the database together in the same directory.
>>You should be able to copy the program everywhere, as long the .exe and the
>>.mdb files are together in the same directory.

>>The program works fine, but i still had to set in the database properties the
>>full path for the database file :-(

>>So, the program should seek the database in the directory in which the program
>>is ( No fixed path !)

>I don't know how to get a completely movable setup for this, but if you set up
> Global Const DBname = "C:\path\database.mdb"
>and then in the Form_Load
>     datControl.DatabaseName =DBname
>then you only need to change the path as required.

app.path & "\<database name>"


Mon, 10 Nov 1997 03:00:00 GMT  
 How to set path for database (.mdb) file ???


Quote:

>OK, here's my problem...

>I write a database application using a Access2.0 database (.mdb) file,
and
>I want the executable and the database together in the same directory.
>You should be able to copy the program everywhere, as long the .exe and
the
>.mdb files are together in the same directory.

>The program works fine, but i still had to set in the database
properties the
>full path for the database file :-(

>So, the program should seek the database in the directory in which the
program
>is ( No fixed path !)

>How can i program this ?

>All kind of tip or source codes are welcome

>Thanks in advance

>Guenter Kaiser



use the AppPath Function..... I use it and it works great, just store it
to a global variable in your startup basic file. :)

Doug Morency



Tue, 11 Nov 1997 03:00:00 GMT  
 How to set path for database (.mdb) file ???

Quote:
>I write a database application using a Access2.0 database (.mdb) file, and
>I want the executable and the database together in the same directory.
>You should be able to copy the program everywhere, as long the .exe and the
>.mdb files are together in the same directory.
>The program works fine, but i still had to set in the database properties the
>full path for the database file :-(
>So, the program should seek the database in the directory in which the program
>is ( No fixed path !)
>How can i program this ?

Hi,

Try this code:

    BDfile$ = App.Path + "\MyDB.MDB"
    Data1.DatabaseName = BDfile$

Best regards,


Univ.Autonoma de Lisboa - Lisboa, Portugal - European Union
Departamento de Informatica (Computer Science Dept.)



Wed, 12 Nov 1997 03:00:00 GMT  
 How to set path for database (.mdb) file ???

Quote:
>OK, here's my problem...

>I write a database application using a Access2.0 database (.mdb) file, and
>I want the executable and the database together in the same directory.
>You should be able to copy the program everywhere, as long the .exe and the
>.mdb files are together in the same directory.

>The program works fine, but i still had to set in the database properties the
>full path for the database file :-(

>So, the program should seek the database in the directory in which the program
>is ( No fixed path !)

>How can i program this ?

>All kind of tip or source codes are welcome

>Thanks in advance

>Guenter Kaiser



..not so hard...

If you are using a data control, set the filename property to 'app.path &
your_filename'.

This can be used when opening a database object thus:

DB = Opendatabase(app.path & 'your_filename')

Doug Miller



Thu, 13 Nov 1997 03:00:00 GMT  
 How to set path for database (.mdb) file ???


Subject: Re: How to set path for
database (.mdb) file ???

Quote:
> Global Const DBname = "C:\path\database.mdb"
>and then in the Form_Load
>     datControl.DatabaseName =DBname
>then you only need to change the path as required.

     You also need datControl.Refresh

_
Pennsylvania ---> Taxsylvania
QWicKeSST - The ultimate database QWK reader, and NO limits. #BLYGJOMK
Special Compile: 1.008A (Alpha)

Quote:
>> Slipstream Jet - The QWK solution for Usenets #OGKMBWAH



Wed, 19 Nov 1997 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Setting path to location of current mdb file

2. Setting path to database from text file ??

3. PATH-APP AND MDB-PATH

4. app-path and mdb-path

5. .mdb file path in crystal report

6. Setting Path to Access Database

7. Setting Path to Access Database

8. Set Database Name property using no path

9. Set Database path

10. How to set database path for .rpt

11. Set database location path problem (OCX) (C++)

12. Database Path Setting in Registry

 

 
Powered by phpBB® Forum Software