在2007中如果,想在两个表的附件之间传递文件,可以用如下的语句:
'用变量来保存图片的话,就会出错
With rstBIPO
With .Fields("bipoimage").Value
If Dir(strPicPath) <> "" Then
Kill strPicPath
End If
.Fields("filedata").SaveToFile (strPicPath)
If .RecordCount > 0 Then
.MoveFirst
Do Until .EOF
.Delete
.MoveNext
Loop
End If
End With
End With
With rstPart
.Edit
Set rstPic = .Fields("partimage").Value
With rstPic
If .RecordCount > 0 Then
.MoveFirst
Do Until .EOF
.Delete
.MoveNext
Loop
End If
If Dir(strPicPath) <> "" Then
.AddNew
.Fields("filedata").LoadFromFile strPicPath
.Update
Kill strPicPath
End If
End With
.Update
.Close
End With
Set rstPart = Nothing
End If