简体   繁体   English

检查附件字段是否为空 vba 访问

[英]check if attachment field is empty vba access

I have a form with a combo box for a user to select from a range of dates.我有一个带有组合框的表单,供用户从一系列日期中进行选择。 The form is based of a table where each date is a record.该表单基于一个表格,其中每个日期都是一条记录。 Each date has up to 6 attachments, each in a separate field.每个日期最多有 6 个附件,每个附件位于一个单独的字段中。 How can I check if an attachment field is empty when a user selects a date?当用户选择日期时,如何检查附件字段是否为空? I am trying to code an "On Click" event.我正在尝试编写“点击”事件。

I also want to make it so that if a certain field lacks an attachment, then the checkbox that would normally allow a user to select that attachment will be greyed-out and say something like "No data exists for this date"我还想这样做,如果某个字段缺少附件,那么通常允许用户选择该附件的复选框将变灰并显示“此日期不存在数据”之类的内容

I tried doing a simple if statement我试着做一个简单的 if 语句

'Go through the recordset, testing each record to see if the date matches the selected one
'If it doesn't match, go to the next one
While Not fldDate = dteDate
    rst.MoveNext
    Wend
MsgBox fldDate

If rstPIANO.Fields("FileName") = Null Then MsgBox "No PIANO Data exists for this date"
If rstMassBalance.Value = Null Then MsgBox "No Mass Balance Data exists for this date"
If rstIR.Value = Null Then MsgBox "No IR Data exists for this date"
If rstD86.Value = Null Then MsgBox "No D86 Data exists for this date"
If rstGC.Value = Null Then MsgBox "No GC Data exists for this date"
If rstMiniGasGraphs.Value = Null Then MsgBox "No Mini Gas Graph Data exists for this date"

This gives me an error that says "Object invalid or no longer set"这给了我一个错误,提示“对象无效或不再设置”

您的记录集被称为 rst 您在每个 IF 语句中都将其称为不同的东西 rstPiano 不存在使用 If rst.fields("Piano") = null

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

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