Export (0) Print
Expand All

Field2.LoadFromFile Method

Office 2007
Loads the specified file from disk.

Version Information
 Version Added:  Access 2007

Syntax

expression.LoadFromFile(FileName)

expression   A variable that represents a Field2 object.

Parameters

NameRequired/OptionalData TypeDescription
FileNameRequiredStringThe fully qualified path of the file to that you want to load.

Example

The following code snippet uses the LoadFromFile method to load an employee's picture from disk.

Visual Basic for Applications
   '  Instantiate the parent recordset. 
   Set rsEmployees = db.OpenRecordset("Employees")
 
   … Code to move to desired employee
 
   ' Activate edit mode.
   rsEmployees.Edit
 
   ' Instantiate the child recordset.
   Set rsPictures = rsEmployees.Fields("Pictures").Value 
 
   ' Add a new attachment.
   rsPictures.AddNew
   rsPictures.Fields("FileData").LoadFromFile "EmpPhoto39392.jpg"
   rsPictures.Update
 
   ' Update the parent record
   rsEmployees.Update



Community Additions

ADD
Show:
© 2014 Microsoft