I have a form with a button to open another form
The 2nd form has a subform
On the subform is a control called txtPaidDate that holds a value called PaidDate
When I open the form it filters the form for just the selected Customer
I also want it to only show the events that have nothing in the PaidDate Field.
This is what I have on the click event, but it still shows the records with a paiddate, I've tried a few variations but no luck.
CODE
Private Sub cmdShowUnpaid_Click()
On Error GoTo Err_cmdShowUnpaid_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCustEvents"
[color="red"]stLinkCriteria = "[ID]=" & Me![ID] & " AND [PaidDate]="""[/color]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdShowUnpaid_Click:
Exit Sub
Err_cmdShowUnpaid_Click:
MsgBox Err.Description
Resume Exit_cmdShowUnpaid_Click
End Sub
On Error GoTo Err_cmdShowUnpaid_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCustEvents"
[color="red"]stLinkCriteria = "[ID]=" & Me![ID] & " AND [PaidDate]="""[/color]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdShowUnpaid_Click:
Exit Sub
Err_cmdShowUnpaid_Click:
MsgBox Err.Description
Resume Exit_cmdShowUnpaid_Click
End Sub
The Form with the button is called frmCustomers
The form it opens is called frmCustEvents
The subform with the PaidDate field is called frmCustEventsSubForm
The PaidDate filed is DataType Date
It is definately the second part of the criteria that is the problem, without & " AND [PaidDate]="""" it works fine
Regards
Brendan