Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2002
    Posts
    5

    Unanswered: Get current directory in Access VB Module

    I need to get the full path of a text file that I want to import (on D drive)(thanks JefB!), and have tried to use the following code:

    Set fs = Server.CreateObject("Scripting.FileSystemObject")
    path = fs.GetAbsolutePathName("d:")


    but get

    Run-Time error '424' Object required

    What am I doing wrong?

  2. #2
    Join Date
    Aug 2002
    Location
    Québec, Canada
    Posts
    109
    Server is for ASP coding, you can remove it, try that:

    Code:
    'Add a reference to Microsoft Scripting Runtime
    Dim fso As New FileSystemObject
    MsgBox fso.GetAbsolutePathName("D:"), , "REFERENCE"
    
    'Without reference
    Dim fso2
    Set fso2 = CreateObject("Scripting.FileSystemObject")
    MsgBox fso2.GetAbsolutePathName("D:"), , "W/O REFERENCE"
    See the first method, by using a reference, it might work better since your object is declared as a FileSystemObject and not as a Object

    JefB - hope it helps

  3. #3
    Join Date
    Sep 2002
    Posts
    5
    Perfect-thanks!

Posting Permissions

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