0

How can you determine if in Attachment field in Access does not contain an attachment using VBA? I tried

If IsNull(rstMassBalance.Fields("FileName"))

and

If rstMassBalance.Fields("FileName") = Null

but neither of these work. It either does nothing or gives me run-time error 3021 that says "No current record"

4

1 回答 1

0

我不使用该Attachments字段,但附件是Recordset2Value附件字段的属性中检索到的。

Dim rsChild As DAO.Recordset2

Set rsChild = rstMassBalance.Fields("FileName").Value

Nothing如果没有附件,我不确定这是否会返回或一个空记录集。所以要么:

If rsChild Is Nothing Then
'or 
If rsChild.RecordCount  <= 0 Then   'probably this one

可以从这个Access 博客中获得很多信息。

在 DAO 中使用附件建议您可以检查:

If rsChild.EOF Then
于 2013-07-17T21:42:49.093 回答