0

VBA コードを介したアクセスで添付ファイルとして埋め込まれている画像をエクスポートしようとしています。何らかの理由で、コンパイル エラーが発生し続けます: メソッドまたはデータ メンバーが.SaveToFileパーツに見つかりません。

   Private Sub btnExport_Click()
'  Instantiate the parent recordset.

Dim rsPicture As ADODB.Recordset
Set rsPicture = New ADODB.Recordset

rsPicture.ActiveConnection = CurrentProject.Connection

rsPicture.Open "Select * from Pictures"

rsPicture.MoveFirst

 '  Set rsPicture = db.OpenRecordset("Pictures")


   ' Instantiate the child recordset.
   Set rsPicture = rsPictureTable.Fields("Picture").Value

   '  Loop through the attachments.
   While Not rsPicture.EOF

      '  Save current attachment
      rsPicture.Fields("FileData").SaveToFile _
                  "C:\Pics"
      rsPicture.MoveNext
   Wend

End Sub
4

1 に答える 1

0

添付ファイルはRecordset2オブジェクト (およびField2) にあります。

Set rsPicture = New ADODB.Recordset2

エラー メッセージが示すように、実際には、オブジェクトにはメソッドFieldがなく、オブジェクトにはメソッドがあります。SaveToFileField2

ここのヘルプ システムにあるものよりも完全な例があります。

于 2013-07-30T14:30:22.957 に答える