0

ユーザーが日付の範囲から選択するためのコンボボックスを備えたフォームがあります。フォームは、各日付がレコードであるテーブルに基づいています。各日付には最大 6 つの添付ファイルがあり、それぞれが別のフィールドにあります。ユーザーが日付を選択したときに、添付ファイル フィールドが空かどうかを確認するにはどうすればよいですか? 「クリック時」イベントをコーディングしようとしています。

また、特定のフィールドに添付ファイルがない場合、通常はユーザーがその添付ファイルを選択できるチェックボックスがグレー表示され、「この日付のデータはありません」のようなメッセージが表示されるようにしたいと考えています。

簡単な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"

これにより、「オブジェクトが無効であるか、設定されていません」というエラーが表示されます

4

1 に答える 1

0

あなたのレコードセットは rst と呼ばれます IF ステートメントごとに異なる名前を付けています rstPiano は存在しません If rst.fields("Piano") = null を使用します

于 2013-07-23T13:31:10.080 に答える