有些人可以看看下面的我和建議我做錯了什麼。我想根據從組合框窗體上選擇的數據,其結果在連接到主窗體什麼事件處理Microsoft Access 2003中窗體上的所有控件?
Private Sub Form_AfterUpdate()
Dim LSQL As String
Dim cmb As ComboBox
Dim txt As TextBox
Dim chk As CheckBox
For Each Control In Me.Controls
If IsNull(cmb.Value) Then
Form_ReportSubForm.RecordSource = "datamanager"
requerysubform
Else
If IsNull(txt.Value) Then
Form_ReportSubForm.RecordSource = "datamanager"
requerysubform
Else
If chk.Value = False Then
Form_ReportSubForm.RecordSource = "datamanager"
requerysubform
Else
LSQL = "SELECT * from datamanager"
LSQL = LSQL & " WHERE engineerid = cmbengid AND membername = cmbtm AND department = cmbdept"
Form_ReportSubForm.RecordSource = LSQL
requerysubform
End If
End If
End If
Next
End Sub
當窗體上的3個控件更新子窗體中生成運行SQL查詢,沒有任何反應在附加的子表單中,告訴我我可能在錯誤的事件中輸入了這段代碼。 你能幫忙嗎?
這是Access嗎?如果是這樣,什麼版本?否則,請說出這是什麼。 – 2009-07-16 17:20:10
抱歉應該提到。這是Access '03。謝謝 – TT1611 2009-07-16 17:21:42