I am trying to run something that I found online (see code block below).
I am getting the error message:
Compile Error: Method or data member not found" and it is highlighting .LoadFromFile
Any ideas on why this is stuck here?
Public Sub OneTimeImport()
Dim strPath As String
strPath = "myfilepath"
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject") 'this avoids adding the reference to this - but you loose the easier to write code stuff
Dim con As ADODB.Connection
Dim rs As New ADODB.Recordset
Set con = CurrentDb.Connection 'this part might need some adjustment
rs.Open "SELECT * FROM dbo_Bor_spr_Surface_Master"
If Not rs.EOF Then
Do While Not rs.EOF
If fs.FileExists(strPath & "\" & rs("Seed_ID") & ".jpg") Then
rs("Photo").LoadFromFile strPath & "\" & rs("Seed_ID")
rs.Update
End If
rs.MoveNext
Loop
End If
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
Set fs = Nothing
End Sub