Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2004
    Posts
    29

    Unanswered: File exists on current

    Hi,

    I have a database that has 690,000 rows in it, and i need to check if the filepath is correct to the file itself. I believe that i can use this in a report/form to test this.

    the name of the column i need to check is "datapath" and it is going to the directory "j:\accounting". after this, it goes into 134 different folders.

    is there an easy way to do this.

    Thanks

    Jeff

  2. #2
    Join Date
    Aug 2005
    Location
    D/FW, Texas, USA
    Posts
    78
    going out to check the sytem for each file is probably going to be pretty slow. What you may want to do is use FSO or something similar to load a table with all of the files that exist on the system.

    Then you can use a couple queries to check all the files as a batch. My guess is that it would run a lot faster.

    (But to answer your question, you can use the fso.FileExists() method to check if a file is there. You'll just have to run it 690,000 times.)
    --wayne
    SELECT * FROM Users WHERE Clue>0
    0 rows returned

  3. #3
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Hiya Wayne how is F/W today? Dallas is doing fine. Nice to know ya neighbor

  4. #4
    Join Date
    Oct 2004
    Posts
    29
    Quote Originally Posted by wayneph
    going out to check the sytem for each file is probably going to be pretty slow. What you may want to do is use FSO or something similar to load a table with all of the files that exist on the system.

    Then you can use a couple queries to check all the files as a batch. My guess is that it would run a lot faster.

    (But to answer your question, you can use the fso.FileExists() method to check if a file is there. You'll just have to run it 690,000 times.)
    Not sure how to do this. Any extra help would be greatly appreciated.

  5. #5
    Join Date
    Mar 2006
    Posts
    163
    The only way I think you could do this would be to create a user defined function.

    You could pass the filename to it and it could check it exists.

    Code:
    Function DoesFileExist(strFileName As String) As Boolean
          DoesFileExist = Dir(strFileName)<>""
    End Function
    This could be used as an expression in a query.

  6. #6
    Join Date
    Apr 2006
    Posts
    157
    it's the exact same thing,

    i just patch this in the oncurrent of my record display form

    if fileexists(datapath) then
    text1.text = "file ok"
    else
    text1.text = "corrupt or missing file"
    endif



    Private Function FileExists(fname) As Boolean
    Dim x As String
    Dim msgrep As String

    x = Dir(fname)

    If x <> "" Then
    FileExists = True
    Else
    FileExists = False
    End If

    End Function

    so, you only know that each record's datafile is ok when you navigate to the record itself,

    other wise you would have to do on startup form something like
    for i = 1 to eof
    fileexist thing...




    Private Function FileExists(fname) As Boolean
    Dim x As String
    Dim msgrep As String

    x = Dir(fname)

    If x <> "" Then
    FileExists = True
    Else
    FileExists = False
    End If

    End Function


    ...I'm using a similar database, but it's hell on security... I'd have to give maximum permissions to clients...

    did this help?

    syntaxerror
    Only quitters quit!

Posting Permissions

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