Hi All,
Firstly I am working in access 2010. I am trying to create an event (activated by clicking a button on a form) where by a filtered report will be opened. The form in question is bound to the table where the results will be coming from and contains an option group with three options: 1 month (value = 1), 2 months (value = 2) and 3 months (value = 3).
So we're clear the report I am trying to generate will show renewal dates within 1, 2, or 3 months from the current date.
I have the current code:
It is compiled and does work if I take out the report filter. I have also done a debug.print and it is selecting the correct case depending on which option is selected. But as soon as I put the filter in the report won't open. I feel that the answer is fairly simple but I have tried a number of times with various strings and I can't get it to work.
Thanks in advance
Firstly I am working in access 2010. I am trying to create an event (activated by clicking a button on a form) where by a filtered report will be opened. The form in question is bound to the table where the results will be coming from and contains an option group with three options: 1 month (value = 1), 2 months (value = 2) and 3 months (value = 3).
So we're clear the report I am trying to generate will show renewal dates within 1, 2, or 3 months from the current date.
I have the current code:
Code:
Option Compare Database
Private Sub Find_record_Click()
Dim strDate As Date
Select Case Me.Frame15.Value
Case Is = 1
strDate = DateAdd("d", 30, Now())
If Me.Check24 = "0" Then
Call DoCmd.OpenReport("SFIND report", acViewReport, , "Renewal Date <" & strDate)
ElseIf Me.Check24 = "-1" Then
Call DoCmd.OpenReport("SFIND Report2", acViewReport, , "Renewal Date <" & strDate)
End If
Case Is = 2
strDate = DateAdd("d", 60, Now())
If Me.Check24 = "0" Then
Call DoCmd.OpenReport("SFIND report", acViewReport, , "Renewal Date <" & strDate)
ElseIf Me.Check24 = "-1" Then
Call DoCmd.OpenReport("SFIND Report2", acViewReport, , "Renewal Date <" & strDate)
End If
Case Is = 3
strDate = DateAdd("d", 90, Now())
If Me.Check24 = "0" Then
Call DoCmd.OpenReport("SFIND report", acViewReport, , "Renewal Date <" & strDate)
ElseIf Me.Check24 = "-1" Then
Call DoCmd.OpenReport("SFIND Report2", acViewReport, , "Renewal Date <" & strDate)
End If
End Select
End Sub
Thanks in advance
Comment