Default Pictures Folder

T

Troy B

I have an application ready for deployment. I have photos
which is in the Current Path directory. I split the
database and I want the photos in the Database directory
so when I send out updates to the front end the Tables and
photos won't be effected. I've got the Add Photos method
set to the Current Path directory. Can I set path to the
photos to the directory where the user places the tables,
even though I don't know where that directory will be at
the time of installation? I would like for that directory
to show as the default instead of the Current Path.
 
D

Douglas J. Steele

The path the current database is in can be determined as either:

CurrentProject.Path

or

Left$(CurrentDb().Path, Len(CurrentDb().Path) - Len(Dir$(CurrentDb().Path)))
 
T

Troy B

I think I was not too clear, initially. I want the photos
in the Tables database so I don't alter the photos when I
update the front end. I would like to go to that
directory when I insert photos using a getfile procedure.
 
D

Dirk Goldgar

Troy B said:
I think I was not too clear, initially. I want the photos
in the Tables database so I don't alter the photos when I
update the front end. I would like to go to that
directory when I insert photos using a getfile procedure.

So you want to know what folder the back-end is in? You can extract
that from the Connect property of one of the linked tables. For
example, here's a function that use a table named "tblProfile" --
assumed to be present -- to get the path to the back-end:

'----- start of code -----
Function fncDataDBName() As String

' Return the name (including path) of the "back-end" database
' containing the data this application is working with. If the
' data tables are local, not linked, return the name of the
' current database.

Static strDBFileName As String

If Len(strDBFileName) = 0 Then
strDBFileName = CurrentDb.TableDefs("tblProfile").Connect
If Left$(strDBFileName, 10) = ";DATABASE=" Then
strDBFileName = Mid$(strDBFileName, 11)
Else
strDBFileName = CurrentDb.Name
End If
End If

fncDataDBName = strDBFileName

End Function
'----- end of code -----
 
T

Troy B

Thank you Dirk, so much. You guys are wonderful.
-----Original Message-----
procedure.

So you want to know what folder the back-end is in? You can extract
that from the Connect property of one of the linked tables. For
example, here's a function that use a table named "tblProfile" --
assumed to be present -- to get the path to the back-end:

'----- start of code -----
Function fncDataDBName() As String

' Return the name (including path) of the "back-end" database
' containing the data this application is working with. If the
' data tables are local, not linked, return the name of the
' current database.

Static strDBFileName As String

If Len(strDBFileName) = 0 Then
strDBFileName = CurrentDb.TableDefs ("tblProfile").Connect
If Left$(strDBFileName, 10) = ";DATABASE=" Then
strDBFileName = Mid$(strDBFileName, 11)
Else
strDBFileName = CurrentDb.Name
End If
End If

fncDataDBName = strDBFileName

End Function
'----- end of code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top