Share via


Field2.LoadFromFile Method

Access Developer Reference

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

Name Required/Optional Data Type Description
FileName Required String The 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

See Also