Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Posts
    154

    Question Unanswered: Opening other programs in Access

    I know how to code to open other programs up in Access and display a certain file or image or something, but does anyone out there know how to or if it is possible to open all files that are LIKE a text field (ie--as SQL has the LIKE txtField & "*")? We scan BOLs and pictures of the items that we make and sell at the company that I work for, and two different people enter the names for them and like anywhere else where you have more that one person entering textual data, not all the names follow exactly the same format. They are, though, stored in the same place. So, if I could figure out a way to examine all the filenames in that folder and then open all of them that are like the text field, that would be wonderful. Thank you in advance for your time and your replies.

  2. #2
    Join Date
    Sep 2004
    Location
    Tampa, FL
    Posts
    520

    I am probally wrong

    In your code you can use DOS statements.

    Example: I have this code to print multiple Word docs ( I had help from here)
    Code:
    db = Dir("c:\rezdb\pas\*.doc")
        Do Until db = ""
            filename = "c:\rezdb\pas\" & db
            Wrd.Documents.Open filename
            Set PrintDoc = ActiveDocument
            PrintDoc.PrintOut Background:=False
            PrintDoc.Close
            db = Dir
        Loop
        Wrd.Quit
    Darasen

  3. #3
    Join Date
    Nov 2002
    Posts
    154

    Thanks

    Thank you Darasen. What data type is db if I wanted to declare it? Any idea what changes might be needed to do this for Acrobat?

  4. #4
    Join Date
    Sep 2004
    Location
    Tampa, FL
    Posts
    520
    Is is a string. that was just a portion of the code to show you the use of the DOS wildcard.
    here is the code in it's entirety if it helps.
    Code:
    Dim db As String
    Dim filename As String
    Dim Wrd As Word.Application
    Dim PrintDoc As Word.Document
    
    Dim WordObj As Object
    
    On Error Resume Next
    Set Wrd = GetObject(, "Word.Application")
    If Err.number <> 0 Then
    Set Wrd = CreateObject("Word.Application")
    End If
    On Error GoTo 0
    
    db = Dir("c:\rezdb\pas\*.doc")
    Do Until db = ""
    filename = "c:\rezdb\pas\" & db
    Wrd.Documents.Open filename
    Set PrintDoc = ActiveDocument
    PrintDoc.PrintOut Background:=False
    PrintDoc.Close
    db = Dir
    Loop
    Wrd.Quit
    Set Wrd = Nothing
    Darasen

Posting Permissions

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