How do I find out in Report_Open if the Report is opend with a fil

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

in an ADP I want to discover in the Report_Open-event, if a filter or
where-condition is set by DoCmd.OpenReport. If not, I want to ask the user
for a parameter.

Thanks.

Tobias
 
I haven't tested this in an ADP, however in an MDB your code might be
something like:

If Len(Me.Filter & "") = 0 Then
Me.Filter = InputBox([Enter a proper filter string])
Me.FilterOn = True
End If
 
Duane Hookom said:
I haven't tested this in an ADP, however in an MDB your code might be
something like:

If Len(Me.Filter & "") = 0 Then
Me.Filter = InputBox([Enter a proper filter string])
Me.FilterOn = True
End If

--
Duane Hookom
MS Access MVP


Tobias Olbort said:
Hello,

in an ADP I want to discover in the Report_Open-event, if a filter or
where-condition is set by DoCmd.OpenReport. If not, I want to ask the user
for a parameter.

Thanks.

Tobias
 
Hello Duane,

sorry, but I did'nt mention, that Filter and ServerFilter stay empty when
Report is opened via DoCmd.OpenReport with a WHERE-clause.

Tobias

Duane Hookom said:
I haven't tested this in an ADP, however in an MDB your code might be
something like:

If Len(Me.Filter & "") = 0 Then
Me.Filter = InputBox([Enter a proper filter string])
Me.FilterOn = True
End If

--
Duane Hookom
MS Access MVP


Tobias Olbort said:
Hello,

in an ADP I want to discover in the Report_Open-event, if a filter or
where-condition is set by DoCmd.OpenReport. If not, I want to ask the user
for a parameter.

Thanks.

Tobias
 
My testing suggests the Where clause is in the ServerFilter property. I
added a text box to the report header with a control source of:
=[ServerFilter]
and it accurately displayed the Where clause from the DoCmd.OpenReport.

--
Duane Hookom
MS Access MVP
--

Tobias Olbort said:
Hello Duane,

sorry, but I did'nt mention, that Filter and ServerFilter stay empty when
Report is opened via DoCmd.OpenReport with a WHERE-clause.

Tobias

Duane Hookom said:
I haven't tested this in an ADP, however in an MDB your code might be
something like:

If Len(Me.Filter & "") = 0 Then
Me.Filter = InputBox([Enter a proper filter string])
Me.FilterOn = True
End If

--
Duane Hookom
MS Access MVP


Tobias Olbort said:
Hello,

in an ADP I want to discover in the Report_Open-event, if a filter or
where-condition is set by DoCmd.OpenReport. If not, I want to ask the
user
for a parameter.

Thanks.

Tobias
 
Hello Duane,

you are right, the same works in my report. But in Report_Open the
ServerFilter has no value!

Tobias

Duane Hookom said:
My testing suggests the Where clause is in the ServerFilter property. I
added a text box to the report header with a control source of:
=[ServerFilter]
and it accurately displayed the Where clause from the DoCmd.OpenReport.

--
Duane Hookom
MS Access MVP
--

Tobias Olbort said:
Hello Duane,

sorry, but I did'nt mention, that Filter and ServerFilter stay empty when
Report is opened via DoCmd.OpenReport with a WHERE-clause.

Tobias

Duane Hookom said:
I haven't tested this in an ADP, however in an MDB your code might be
something like:

If Len(Me.Filter & "") = 0 Then
Me.Filter = InputBox([Enter a proper filter string])
Me.FilterOn = True
End If

--
Duane Hookom
MS Access MVP


Hello,

in an ADP I want to discover in the Report_Open-event, if a filter or
where-condition is set by DoCmd.OpenReport. If not, I want to ask the
user
for a parameter.

Thanks.

Tobias
 
If you wrote the code to open the report, you should be able to determine
this before the report is ever opened.

--
Duane Hookom
MS Access MVP
--

Tobias Olbort said:
Hello Duane,

you are right, the same works in my report. But in Report_Open the
ServerFilter has no value!

Tobias

Duane Hookom said:
My testing suggests the Where clause is in the ServerFilter property. I
added a text box to the report header with a control source of:
=[ServerFilter]
and it accurately displayed the Where clause from the DoCmd.OpenReport.

--
Duane Hookom
MS Access MVP
--

Tobias Olbort said:
Hello Duane,

sorry, but I did'nt mention, that Filter and ServerFilter stay empty
when
Report is opened via DoCmd.OpenReport with a WHERE-clause.

Tobias

:

I haven't tested this in an ADP, however in an MDB your code might be
something like:

If Len(Me.Filter & "") = 0 Then
Me.Filter = InputBox([Enter a proper filter string])
Me.FilterOn = True
End If

--
Duane Hookom
MS Access MVP


Hello,

in an ADP I want to discover in the Report_Open-event, if a filter
or
where-condition is set by DoCmd.OpenReport. If not, I want to ask
the
user
for a parameter.

Thanks.

Tobias
 
Back
Top