2013-07-08 24 views
0

我有一個組合框的窗體供用戶從一系列日期中進行選擇。該表格基於一個表格,其中每個日期都是一條記錄。每個日期最多有6個附件,每個附件都在一個單獨的字段中。如何在用戶選擇日期時檢查附件字段是否爲空?我正在嘗試編寫一個「點擊」事件。檢查附件字段是否爲空vba access

我也想這樣做,如果某個領域缺乏附件,那麼通常會允許用戶選擇該附件的複選框會變灰,並且會說出類似「此數據不存在數據」

我試圖做一個簡單的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" 

這給了我,說:「對象無效或不再設置」

+0

你所說的「attachement」的意思是他們是文件上的文件系統?你DB的某些表中的行?你的第二句話在「分開」之後過早結束......分開什麼? –

+0

請描述你到目前爲止所嘗試過的以及爲什麼它不起作用。 –

回答

0

你的記錄被稱爲第一個錯誤 你調用它不同的東西在每個IF語句 rstPiano不存在 使用 如果rst.fields(「鋼琴」)= NULL