P
Paul Martin
Hi All,
I am using a combo-box to select a contact name, which I then use to
restrict the associated sub-form. It seems to work just fine, except that
when the code has run that restricts the sub-form I can no longer close the
form.
In order to restrict the sub-form, I use the following code:
If Nz(cmbContact.Column(1), "") <> "" Then
strSQL = "SELECT tblCustCalls.* FROM tblCustCalls WHERE
(((tblCustCalls.ContactID)=" _
& Nz(cmbContact.Column(1), 0) & ")) ORDER BY
tblCustCalls.CallDate DESC;"
Else
strSQL = "SELECT tblCustCalls.* FROM tblCustCalls WHERE
(((tblCustCalls.CustID)=" _
& Nz([txtCustID], 0) & ")) ORDER BY tblCustCalls.CallDate
DESC;"
End If
Me.frmCallSub1.Form.RecordSource = strSQL
DoEvents
Can anyone give any suggestions as to what I've done wrong?
Thanks & Regards,
Paul Martin
I am using a combo-box to select a contact name, which I then use to
restrict the associated sub-form. It seems to work just fine, except that
when the code has run that restricts the sub-form I can no longer close the
form.
In order to restrict the sub-form, I use the following code:
If Nz(cmbContact.Column(1), "") <> "" Then
strSQL = "SELECT tblCustCalls.* FROM tblCustCalls WHERE
(((tblCustCalls.ContactID)=" _
& Nz(cmbContact.Column(1), 0) & ")) ORDER BY
tblCustCalls.CallDate DESC;"
Else
strSQL = "SELECT tblCustCalls.* FROM tblCustCalls WHERE
(((tblCustCalls.CustID)=" _
& Nz([txtCustID], 0) & ")) ORDER BY tblCustCalls.CallDate
DESC;"
End If
Me.frmCallSub1.Form.RecordSource = strSQL
DoEvents
Can anyone give any suggestions as to what I've done wrong?
Thanks & Regards,
Paul Martin