If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back  dBforums > PC based Database Applications > Microsoft Access > linking files to table

LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Registered User
Join Date: Sep 2011
Posts: 66
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
Reply With Quote
  #2 (permalink)  
(Making Your Life Easy)
Join Date: Feb 2004
Location: New Zealand
Posts: 1,275
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\frenchtouch.co.nz\Big")
aa = GenerateAllFolderInformation("D:\~WWW\Sites\frenchtouch.co.nz\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
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
Reply With Quote
  #3 (permalink)  
Registered User
Join Date: Sep 2011
Posts: 66
thanks myle i will get back if any doubts
Reply With Quote
  #4 (permalink)  
Registered User
Join Date: Sep 2011
Posts: 66
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..
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On