By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

Application.CurrentProject.Path question on storing

P: 47
Can this be saved somehow in a field in the database along with some other address criteria, so I can always be looking at the current location.
like this?

Application.CurrentProject.Path\year\month\nbr 9.jpg

and when pulled out, you get

C:\Folder1\year\month\nbr 9.jpg

with C:\Folder1 being the current path


Thank you for your help
Ken
Dec 17 '07 #1
Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,273
I'm confused by this question.
The database path is relative to where the database was opened from so storing this value as data would seem to make no sense at all. Clearly there are ways of storing any data you want to, but this seems a strange request.
Can you explain what you want exactly and why?
Dec 17 '07 #2

P: 47
I'm confused by this question.
The database path is relative to where the database was opened from so storing this value as data would seem to make no sense at all. Clearly there are ways of storing any data you want to, but this seems a strange request.
Can you explain what you want exactly and why?
I am wanting to display image on form, the image file location can change, but will always be relative to the database location. I was storing the location, ie
c:\xxxx etc, but when file was moved to new folder, of course the image couldnt be found. So I am trying to establish a way (remember I am new at this part) to create the new address, by adding the relative location of db to file name.
thank You
Dec 17 '07 #3

NeoPa
Expert Mod 15k+
P: 31,273
OK.
I was surprised as I saw you were almost there already.
Indeed, you want to use Application.CurrentProject.Path to find the file if it is relative to the database location.
Something like :
Expand|Select|Wrap|Line Numbers
  1. strImage = Application.CurrentProject.Path & "\year\month\nbr 9.jpg"
Dec 17 '07 #4

P: 47
OK.
I was surprised as I saw you were almost there already.
Indeed, you want to use Application.CurrentProject.Path to find the file if it is relative to the database location.
Something like :
Expand|Select|Wrap|Line Numbers
  1. strImage = Application.CurrentProject.Path & "\year\month\nbr 9.jpg"
Thanks appreciate it

I am using "Private FSO as Scripting.FileSystemObject" to see if this file exists.
1. What reference in Access 2002 is necessary for this
2. I have seen many syntax, for the exists part, but mine is not working
can you help me there or is this overstepping my bounds. In other words should I start a new string
Dec 17 '07 #5

NeoPa
Expert Mod 15k+
P: 31,273
I think a new thread is required here, but for determining if a file exists I use the function :
Expand|Select|Wrap|Line Numbers
  1. 'Exist returns true if strFile exists.
  2. '22/05/2003 Rewritten with better code.
  3. '20/05/2005 Added finding of R/O, System & Hidden files
  4. Public Function Exist(strFile As String, _
  5.                       Optional intAttrib As Integer = &H7) As Boolean
  6.     Exist = (Dir(PathName:=strFile, Attributes:=intAttrib) <> "")
  7. End Function
Dec 17 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.