简体   繁体   English

如何使用 VBA 处理 Microsoft Access 表单中的附件字段?

[英]How to address the attachment field in a Microsoft Access form using VBA?

I build a form where users can create a new record and fill the fields.我构建了一个表单,用户可以在其中创建新记录并填写字段。 One of those fields is the attachment field.这些字段之一是附件字段。 Before they can save the record, I want to check wether they filled in all mandatory fields, the attachment beeing one of those.在他们保存记录之前,我想检查一下他们是否填写了所有必填字段,附件是其中之一。 With all other fields, it works like this:对于所有其他字段,它的工作方式如下:

        If IsNull(date_of_useage) Then
            MsgBox "Please fill in the date!", vbExclamation
            Exit Sub
        End If

This does not work für the attachment field, addressing it by its name "attachment".这对附件字段不起作用,通过其名称“附件”寻址。 How can I check, if the user did or did not attach a file?我如何检查用户是否附加了文件? IsEmpty didnt work either. IsEmpty不起作用。

找到解决方案:

If Attachment.Attachmentcount = 0 Then [...]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM