Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2011

    Unanswered: linking files to table

    i have a form in which i type the batchnumber ( field name ) like 1005003, 1005010 and its stored in a table named tblbatchnumber

    i have a folder which has pdf or xls files of that name like
    ex : 1005003.xls or
    ex : 1005010.pdf

    how to link the file in folder to the batchnumber field so that when ever a new file is added in the folder the file name is stored as a new record in table & in the form if i click the batch number the xls or pdf file should open

    pls help as it will save lot of time all who use it

    i have tried hyperlink its not working & i have checked other different database i displays the complete path of file name

  2. #2
    Join Date
    Feb 2004
    New Zealand
    Provided Answers: 10
    you have to write some code to scan the Folder and check if the batchnumber is in the database

    here is code i use

    Function Clear_Photos()
    Dim aa
    aa = GenerateAllFolderInformation("D:\~WWW\Sites\\Big")
    aa = GenerateAllFolderInformation("D:\~WWW\Sites\\thumbnails")
    End Function
    Function GenerateAllFolderInformation(FolderName)
       Dim FSO
       Dim Files
       Dim File
       Dim Folder
       Dim Checkit
       Dim CheckName
          'MsgBox "Go Have a smoko"
       Set FSO = CreateObject("Scripting.FileSystemObject")
       Set Folder = FSO.GetFolder(FolderName)   
       Set Files = Folder.Files
         aa = 0
         For Each File In Files
        aa = aa + 1
         CheckName = Mid$(File.Name, 1, InStr(File.Name, ".") - 1)
         Checkit = DCount("*", "Prod", "[TYPE] ='" & CheckName & "'") + DCount("*", "Prod", "[Other Images] Like '*" & CheckName & "*'")
            If Checkit = 0 And CheckName <> "" And CheckName <> "Thumbs" Then 'filename not in dataBase
         ' you put you code in here to added to database
            FileCopy File, FolderName & "\Not Used\" & File.Name
            Kill File
            End If
     'MsgBox "Have Finish Moving The Photos to" & vbNewLine & vbNewLine & "p:\photod\not used\"
    End Function
    i have a database that start at midnite and run the Clear_Photos function

    you need to change the Dcount to match your needs
    hope this help

    See clear as mud

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008

  3. #3
    Join Date
    Sep 2011
    thanks myle i will get back if any doubts

  4. #4
    Join Date
    Sep 2011

    thanks for myle for the reply

    sorry to trouble myle

    iam still a very bad access programer ( i think a user )

    i dont know were this code has to be put is it in the ( form ) as i have not put the listbox also to show the name of file if you could ps tell me where & how i put the code i will do pls guide me

    sorry to ask this

    if possible if you can attach a database of that sort i shall make my database as that & will also learn.. or else i will attach my database pls suggest

    pls help i will put my effort to get it..

Posting Permissions

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