Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Importing / Linking / June 2004

Tip: Looking for answers? Try searching our database.

Multiple Input

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
The Worker Bee - 30 Jun 2004 15:49 GMT
I am creating a database that is only to hold information
of the image files of a hard drive. How can i bulk input
the files, or input them by folder so that I don't have
to input every records fields seperately. Some fields are
the image itself; the filesize; the filename (as a
hyperlink) and the type of file. Is there anything I can
do. And I don't want to delete the files as they are
being transferred!

Charlie
John Nurick - 30 Jun 2004 21:56 GMT
Hi Bee,

If you're keeping your data in an mdb file it's not a good idea to store
the image data in the database: instead, leave it in the folders and
just store the paths, filenames, etc. There's a PictureMgr sample
database at http://www.datastrat.com/DataStrat2.html which shows the
techniques.

To get the file information from the drive, there are several ways to
go. I'd use the VBScript FileSystemObject object, which is in the
Microsoft Scripting Runtime library. This lets you do something like
this untested air code:

 Dim dbD As DAO.Database
 Dim rsR As DAO.Recordset
 Dim oFS As Scripting.FileSystemObject
 Dim oF As Scripting.Folder
 Dim oS As Scripting.File
 Dim strType As String
 Dim strFolder As String
 Dim lngSize As Long
 
 strFolder = "C:\Folder\Subfolder"
 strType = "jpg"
 
 Set dbD = CurrentDB()
 Set rsR = dbD.OpenRecordset("MyTable")
 Set oFS = CreateObject(strFolder)
 Set oF = oFS.GetFolder("C:\Folder\Subfolder")
 
 If oF.Files.Count > 0 Then
   For Each oS In oF.Files
     If Right(oS.Name, Len(strType)) = strType Then
       With rsR
         .AddNew
         .Fields("FileName").Value = oS.Name
         .Fields("FileType").Value = oS.Type
         .Fields("FileSize").Value = oS.Len
         .Update
     End If
   Next
 End If
 rsR.Close
 Set rsR = Nothing
 Set dbD = Nothing
 Set oS = Nothing
 Set oF = Nothing
 Set oFS = Nothing

>I am creating a database that is only to hold information
>of the image files of a hard drive. How can i bulk input
[quoted text clipped - 6 lines]
>
>Charlie

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.