I'm attempting to have an unbound Subform updated based on the click of a Checkbox on my main form.
In an attempt to achieve this I've done the following in the chkBox's Before Update Event:
The "big SQL Statement" is the same Query used to successfully populate the subform upon the main form's original load and at every change of the main form's recordsource, and it works flawlessly. The problem I'm getting here is that upon clicking the checkbox on the mainform, I get this error:
Runtime error: 3021
No Current Record
What am I missing here? (This is an unbound subform, displaying results independent of the mainform's dataset.)
I tried to achieve this task using the Filter and Filter On properties of the subform but couldn't make that work.
Any ideas most welcome!!
Thanks,
Shred
In an attempt to achieve this I've done the following in the chkBox's Before Update Event:
Code:
Private Sub chkIgnoreDNC_BeforeUpdate(Cancel As Integer)
Dim strSQL As String, strWhere As String
strWhere = "WHERE (((nz([tblSP]![DNCUntil]))<=Date()))"
strSQL = "SELECT (the big SQL Statement here...)" & _
strWhere & ";"
If chkIgnoreDNC Then
strWhere = ""
strSQL = "SELECT (the big SQL Statement here...)" & _
strWhere & ";"
End if
Forms![MainForm].[subForm].Form.RecordSource = strSQL
End Sub
The "big SQL Statement" is the same Query used to successfully populate the subform upon the main form's original load and at every change of the main form's recordsource, and it works flawlessly. The problem I'm getting here is that upon clicking the checkbox on the mainform, I get this error:
Runtime error: 3021
No Current Record
What am I missing here? (This is an unbound subform, displaying results independent of the mainform's dataset.)
I tried to achieve this task using the Filter and Filter On properties of the subform but couldn't make that work.
Any ideas most welcome!!
Thanks,
Shred