A
Alain
Hi,
I need to open a report based on a date as a filter criteria, the filter
contains 3 date field that need to be checked.
The problem is when I open the report I always get the same error
2451.......report is not open or does not exist,
I do not want to use a criteria at the Query level because it will popup 3
times unless there is a way to apply one input value on three different
field at the same time that I am not aware of, this is the code I am
currently using:
Private Sub Report_Open(Cancel As Integer)
Dim datinput As Date
Dim strFilter As String, strmsg As String
Dim dat1 As Date, dat2 As Date, dat3 As Date
dat1 = Forms!Budget!From
dat2 = Forms!Budget!Exerdaterenoption
dat3 = Forms!Budget!Exerdatecanrights
strmsg = "Veuillez inscrire une date."
datinput = InputBox("Entrez la date de début du budget [MM/DD/YYYY].",
"Budget Date")
'validate if empty
If IsNull(datinput) Then
MsgBox strmsg, vbOKOnly, "Budget Date"
Exit Sub
End If
strFilter = "dat1 <= & #datinput# & OR dat2 <= & #datinput# & OR dat3 <= &
#datinput# &"
With Reports!rptLeaseExpiresBudget
.Filter = strFilter
.FilterOn = True
End With
End Sub
How can I solve the report open problem, I even tried to create a function
to open the report and then applying the filter but no success
TIA
Alain
I need to open a report based on a date as a filter criteria, the filter
contains 3 date field that need to be checked.
The problem is when I open the report I always get the same error
2451.......report is not open or does not exist,
I do not want to use a criteria at the Query level because it will popup 3
times unless there is a way to apply one input value on three different
field at the same time that I am not aware of, this is the code I am
currently using:
Private Sub Report_Open(Cancel As Integer)
Dim datinput As Date
Dim strFilter As String, strmsg As String
Dim dat1 As Date, dat2 As Date, dat3 As Date
dat1 = Forms!Budget!From
dat2 = Forms!Budget!Exerdaterenoption
dat3 = Forms!Budget!Exerdatecanrights
strmsg = "Veuillez inscrire une date."
datinput = InputBox("Entrez la date de début du budget [MM/DD/YYYY].",
"Budget Date")
'validate if empty
If IsNull(datinput) Then
MsgBox strmsg, vbOKOnly, "Budget Date"
Exit Sub
End If
strFilter = "dat1 <= & #datinput# & OR dat2 <= & #datinput# & OR dat3 <= &
#datinput# &"
With Reports!rptLeaseExpiresBudget
.Filter = strFilter
.FilterOn = True
End With
End Sub
How can I solve the report open problem, I even tried to create a function
to open the report and then applying the filter but no success
TIA
Alain