I am quite a novice at Access, although I'm fairly comfortable in Excel so I'm not unfamiliar with VBA and Office Products. We have a report that we run in Access that pulls data based upon a maturity date. One issue we always had was if we ran the report for a date where there was no activity, the date would not appear in the report. I decided to pass the date in from a Form that I built so that the date would appear even if there was no activity for that day. The problem I have now is that when I enter the date in the form the parameter from the report pops up as well. I realize this is because the query under the report uses a parameter on the maturity date field, but if I remove that parameter from the query, the report will display the date in the report, but the results are not filtered by the date.
I'm using the input value in the where clause of the DoCmd statement behind the OK button:
The input box on the form is a text box named Form_Date_Input. In the query I have the following as criteria on the Maturity Date field:
I'm using the input value in the where clause of the DoCmd statement behind the OK button:
Code:
Private Sub Command2_Click()
Dim strWhereCondition As String
strWhereCondition = "[Form_Date_Input] ='" & Me.Form_Date_Input & "'"
DoCmd.OpenReport "CP MATURING ON THIS DATE", acViewPreview, , strWhereCondition
DoCmd.Close acForm, "Enter CP Maturity Date"
End Sub
The input box on the form is a text box named Form_Date_Input. In the query I have the following as criteria on the Maturity Date field:
Code:
[[Forms]![Enter CP Maturity Date]![Form_Date_Input]/CODE]
The name of the form is Enter CP Maturity Date.
One other issue, although the date passes to the print preview of the report, when I print the report that field prints a #Name? error.
So I have a few issues. Hopefully someone can help me with some answers.