Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find the path (Access 2000)

    I want to retrieve the path of the word document placed in the folder MyDocuments. The word document is called Invoice.doc, obtained from my report in the database. I have found out that the path to the folder MyDocuments is different with the different computers and thats is why i need some quick reference of finding the right path for each computer.Is there some easy way of retrieving the path to MyDocuments folder in a given computer? I am doing now manually by right clicking the file,but i want to automate it. Also i need the path with my command DoCmd.OutputTo acOutputReport, "Invoice", acFormatRTF, "Cocuments and SettingsAdministratorMy DocumentsInvoice.rtf", but the path may be different

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Find the path (Access 2000)

    You can use CreateObject("WScript.Shell").SpecialFolders("MyDo cuments") to retrieve the path to the My Documents folder of the current user. In your code:
    <code>
    Dim strPath As String
    Dim strFile As String
    strPath = CreateObject("WScript.Shell").SpecialFolders("MyDo cuments")
    strFile = strPath & "Invoice.rtf"
    DoCmd.OutputTo acOutputReport, "Invoice", acFormatRTF, strFile
    </code>
    Please note that there is no space between My and Documents in the call to SpecialFolders.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find the path (Access 2000)

    Thank you so much ! Such a simple and efficient solution ! I have solved my problem with your elegant suggestion and please accept my very best wishes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •