Results 1 to 11 of 11
  1. #1
    paddymx is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2012
    Posts
    44

    Using CurrentProject.path

    I have a DB that uses the common getfilename function to select images(over 1400) and AVI's(13). I've got it opening the appropriate directory off the CurrentProject.path &... and it works great. But, is there a way to store the reference as CurrentProject.pathxxx rather than the explicit file path ( "C:\DIY_DB_ICU_RT\FlavDBImages\FW\Ginger Flavoring.jpg" ) that is currently being saved? I am hoping to distribute this app but the way it sounds I will need to require the app be installed to the "C:\DIY_DB_ICU_RT\" directory to make use of all the images and AVI's. This limits the users ability to install it where ever they want.



    Any thoughts?

    TNX

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    currentproject.path returns the location of the database you're currently in.

    In your case it's (probably) residing in C:\DIY_DB_ICU_RT and all your jpg's and avi's are in that folder as well, in a specified folder structure.

    if your database was in

    c:\mydb\ the currentproject.path would return c:\mdyb, you would just have to add a trailing "\" mark to make the path valid before defining your subfolders/file names

  3. #3
    paddymx is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2012
    Posts
    44
    Quote Originally Posted by rpeare View Post
    currentproject.path returns the location of the database you're currently in.

    In your case it's (probably) residing in C:\DIY_DB_ICU_RT and all your jpg's and avi's are in that folder as well, in a specified folder structure.

    if your database was in

    c:\mydb\ the currentproject.path would return c:\mdyb, you would just have to add a trailing "\" mark to make the path valid before defining your subfolders/file names
    TNX

    Not sure what you're saying But I get the appropriate paths now. Currently the DB is in C:\DIY_DB_ICU_RT. The images are in C:\DIY_DB_ICU_RT\xx of which I have about 20 and the AVI's are in C:\DIY_DB_ICU_RT\AVI. I am able to retrieve and save them just fine, but, looking in the table it shows the explicit path including the image as C:\DIY_DB_ICU_RT\FlavDBImages\FW\Ginger Flavoring.jpg, etc. My question is, is there a way to save the information using some kind of currentproject.path designation so a user could install the app where ever and locate the images/AVI's off that directory after install. As it stands now the app must be installed in C:\DIY_DB_ICU_RT. If not the user gets an error "can't find file" which would require them to actually re load each image OR I could distribute without images and they could load their own. As I have over 1400 images, seams like a shame to make a user re load all of these.

    Am I making any sense?

    EDIT: I have to go to town, will check back in a couple of hours.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    so you're worrying about the path that is displaying in your table?

    My question would be... how is that path getting there in the first place?
    is it being figured at the time of data entry?
    is the user just typing in a file name and your database is figuring out the rest?
    if that's the case and your subfolder structure will ALWAYS be based on the same structure you have now except the root database may be in, say c:\testdb\storeithere\ instead of c:\diy_db_icu_rt\.

    if the subfolder structure is the same just store the file name with the relevant folder structure like

    \flavdbimages\xx\abc.avi

    instead of the full path, then when you want to access the file just tack on the currentproject.path & table.fieldname.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    You want to save partial path/filename (relative referencing) into record, not the full absolute path?

    Replace("selected path/filename string", CurrentProject.Path, "")

    That should remove the pathing up to the location of the database, assuming users made a selection from a path route used by the database.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    paddymx is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2012
    Posts
    44
    Quote Originally Posted by rpeare View Post
    so you're worrying about the path that is displaying in your table?

    My question would be... how is that path getting there in the first place?
    is it being figured at the time of data entry?
    is the user just typing in a file name and your database is figuring out the rest?
    if that's the case and your subfolder structure will ALWAYS be based on the same structure you have now except the root database may be in, say c:\testdb\storeithere\ instead of c:\diy_db_icu_rt\.

    if the subfolder structure is the same just store the file name with the relevant folder structure like

    \flavdbimages\xx\abc.avi

    instead of the full path, then when you want to access the file just tack on the currentproject.path & table.fieldname.
    Quote Originally Posted by June7 View Post
    You want to save partial path/filename (relative referencing) into record, not the full absolute path? YES

    Replace("selected path/filename string", CurrentProject.Path, "")

    That should remove the pathing up to the location of the database, assuming users made a selection from a path route used by the database.
    rpeare, The user clicks a button which calls the getfilename function and stores the returned value in the table. I came to the conclusion on my drive to town"What" has to be done. Currently the getfilename function returns the complete path for the image file and stores that in the table. So what I need to do is trim the path off the returned value and just store the image filename "anypicture.jpg". then reconstruct as "CurrentProject.Path &"\" & foldername &"\"&image.jpg or something to that affect when needed for the imageframe.picture property when needed.

    June7, if the target is: a strvar "filename" returned by the getfilename function, which ="C:\DIY_DB_RT\FW\image.jpg" , would this : Replace(filename, CurrentProject.Path, "") return "image.jpg" ? Or what would the correct syntax be? I'll be looking up that "Replace" syntax until I hear back..TNX

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    If the project path is "C:\DIY_DB_RT" the Replace function should return "\FW\image.jpg"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    paddymx is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2012
    Posts
    44
    Quote Originally Posted by June7 View Post
    If the project path is "C:\DIY_DB_RT" the Replace function should return "\FW\image.jpg"
    Thanks, I think that will work as the images will be in the "\FW folder. then I could reconstruct using "CurrentProject.Path & [fieldname]", give or take a "\", correct?

    Edit: I'm marking this resolved. Thanks June7 and
    rpeare. Sometimes it helps to bounce things around a bit.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Right, if the value is saved in field with the leading "\" no need to concatenate it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    paddymx is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2012
    Posts
    44
    Quote Originally Posted by June7 View Post
    Right, if the value is saved in field with the leading "\" no need to concatenate it.
    I think it worked.

    DocLoc = tsGetFileFromUser()
    Dim x As Variant
    x = Replace(DocLoc, CurrentProject.path, "")
    MsgBox x


    returned :

    Now to make it work....Thanks

  11. #11
    paddymx is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2012
    Posts
    44
    UPDATE:

    Implemented and works like a charm. Thanks to all...Patrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Need help with network path....
    By cplmckenzie in forum Programming
    Replies: 8
    Last Post: 03-27-2013, 08:40 PM
  2. Replies: 3
    Last Post: 11-24-2012, 08:56 AM
  3. autoexec--currentproject.istrusted
    By Madmax in forum Access
    Replies: 1
    Last Post: 03-06-2012, 06:31 PM
  4. not a valid path
    By JJJ in forum Access
    Replies: 0
    Last Post: 03-28-2011, 10:50 AM
  5. Use of CurrentProject.Path in export code
    By gg80 in forum Programming
    Replies: 1
    Last Post: 08-02-2010, 08:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums