K
keers
Hi All,
I have a form which calculates a date (in the format of mmm yy),I want
to use this date to apply a filter to a query in order to produce the
report. The relevent field in the query is evaluated;
Terminates: IIf(IsNull([DelDateActual]),"No Delivery
Date",Format(DateAdd("m",[Term],[DelDateActual]),"mmm yy"))
The code in my form is;
Private Sub btnRenewals_Click()
Dim strWhere As String
Dim stDocName As String
On Error GoTo Err_btnRenewals_Click
strWhere = """Terminates =" & hdnRenewal.Value & """"
MsgBox strWhere
stDocName = "RepRenewalLetters"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_btnRenewals_Click:
Exit Sub
Err_btnRenewals_Click:
MsgBox Err.Description
Resume Exit_btnRenewals_Click
End Sub
The output from the evaluation being displayed by the msgbox looks
correct to me i.e.
"Terminates = sep 07"
However, the filter is being ignored. If i attempt to filter on a
different field i.e. Surname - the filter works.
Any pointers would be greatly appreciated.
Regards
Keers
I have a form which calculates a date (in the format of mmm yy),I want
to use this date to apply a filter to a query in order to produce the
report. The relevent field in the query is evaluated;
Terminates: IIf(IsNull([DelDateActual]),"No Delivery
Date",Format(DateAdd("m",[Term],[DelDateActual]),"mmm yy"))
The code in my form is;
Private Sub btnRenewals_Click()
Dim strWhere As String
Dim stDocName As String
On Error GoTo Err_btnRenewals_Click
strWhere = """Terminates =" & hdnRenewal.Value & """"
MsgBox strWhere
stDocName = "RepRenewalLetters"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_btnRenewals_Click:
Exit Sub
Err_btnRenewals_Click:
MsgBox Err.Description
Resume Exit_btnRenewals_Click
End Sub
The output from the evaluation being displayed by the msgbox looks
correct to me i.e.
"Terminates = sep 07"
However, the filter is being ignored. If i attempt to filter on a
different field i.e. Surname - the filter works.
Any pointers would be greatly appreciated.
Regards
Keers