Scripted file search fails - security issue?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • djohnson

    #1

    Scripted file search fails - security issue?

    Hi, the script below worked until a few weeks ago. The only change
    that we know of were security changes such as deleting an administrator
    account under which the file was originally created. Does anyone know
    if security issues would make this script below fail and/or how this
    could be resolved? Thanks.


    SourceDir = "G:\test"
    With Application.Fil eSearch
    .NewSearch
    .LookIn = SourceDir
    .SearchSubFolde rs = False
    .Filename = ".txt" ' also tried "*.txt"
    If .Execute() > 0 Then ' returns false even though
    files exist in G:\test
    MsgBox "Success??"
    Else
    MsgBox "Execute() failed"
    End If
    End With



    Dave

  • Rich P

    #2
    Re: Scripted file search fails - security issue?

    You left out a backslash in

    SourceDir = "G:\test"

    This would look for a file called G:\testFile1.tx t

    where what you really want is G:\test\File1.t xt

    Change SourceDir to

    SourceDir = "G:\test\"

    All I did was append a "\" backslash to SourceDir

    Rich

    *** Sent via Developersdex http://www.developersdex.com ***

    Comment

    • djohnson

      #3
      Re: Scripted file search fails - security issue?

      Ok, I originally had the slash and tried it without for testing, so
      even though I added it again, it still doesn't work in my environment.

      The reason I suspect a security issues is that this happened before
      with an InfoPath form I created. We have Office 2003 with InfoPath,
      which does not allow VB Scripts to be run without either a certificate
      or if it was created by a user with administrative privledges. I was
      wondering if Access 2003 may have also inherited this added security.
      Also, the exact same Access form works on another server that has
      Access 2002.

      Comment

      • Rich P

        #4
        Re: Scripted file search fails - security issue?

        I tried your script out in MS Access 2003. It worked fine for me. Here
        is what I tried:


        Sub fileSrch()
        Dim SourceDir As String, i As Integer

        SourceDir = "C:\Code\"
        With Application.Fil eSearch
        .NewSearch
        .LookIn = SourceDir
        .SearchSubFolde rs = True
        '.filename = ".txt"
        .FileType = msoFileTypeData bases '-returns mdb's & ADPs
        If .Execute() > 0 Then
        Debug.Print "Success"
        For i = 1 To .FoundFiles.Cou nt
        Debug.Print .FoundFiles(i)
        Next
        Else
        Debug.Print "Execute did not find anything"
        End If
        End With

        End Sub

        I am not up on security issues, otherwise.


        Rich

        *** Sent via Developersdex http://www.developersdex.com ***

        Comment

        • djohnson

          #5
          Re: Scripted file search fails - security issue?

          I think I need to look at my setup. Due to new policies here my
          security level is very low on this machine. On it your script stops on
          this line,

          ..FileType = msoFileTypeData bases '-returns mdb's & ADPs

          ....without even an error message.

          Do you know if there is a way to turn error message on? Anyway, thanks
          for your effort, and I'll let you know once I figure this out.

          Comment

          • Rich P

            #6
            Re: Scripted file search fails - security issue?

            It probably won't help you feel any better, but I hate it when that
            happens - when stuff doesn't work consistently across all workstations.

            For me, about 99% of the code that I try out from this NG that works on
            someone else's workstation/server will work on my workstations and
            servers. I use winxp on the workstations and Server2003 for the
            servers. If you are on a similar OS then I deduce that it may be a
            configuration issue or maybe you need to run windows update or maybe
            need a newer service pack on your machines.

            Actually, now that I think about it, I have had some issues using mso
            Constants. I was actually kind of surprised that .FileType =
            msoFileTypeData bases returned a list of mdb/adp's from my folder.

            Rich

            *** Sent via Developersdex http://www.developersdex.com ***

            Comment

            Working...