Import txt file from same folder as Database (1 Viewer)

ECEK

Registered User.
Local time
Today, 03:51
Joined
Dec 19, 2012
Messages
717
Is it possible to write VBA that will import a file into the database that is in the same folder that the database is in regardless of the address of the folder?


Or import the name of the folder itself?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 03:51
Joined
Feb 19, 2013
Messages
16,610
is the database split?

for the front end you can use currentdb.name to give the full path - remove the name to give you the path.

if the backend, inspect the tabledefs for a link table to find the path to the backend - think it is currentdb.tabledefs("nameofalinkedtable").connect
 

ECEK

Registered User.
Local time
Today, 03:51
Joined
Dec 19, 2012
Messages
717
Found it !!!!
Code:
Private Sub Form_Open(Cancel As Integer)
Me.Text2 = Application.CurrentProject.Path
End Sub
 

Users who are viewing this thread

Top Bottom