Displaying filter/condition info on report

  • Thread starter Thread starter Alp Bekisoglu
  • Start date Start date
A

Alp Bekisoglu

Hi Experts,

I hope the subject makes sense with what I need to accomplish. I'm calling a
report via an unbound form which sets the Condition(s) for the report.
Partial (end part) code is:
DoCmd.OpenReport "rpt_co_main_contact", acViewPreview, , strWhere

The strWhere can get a bit lengthy having up to 6 conditions. I would like
to print the conditions on the report itself as well. A sample strWhere is:
[co_main.co_ulke]='TURKEY' And [co_main.co_sehir]='ANKARA' And
[co_microsoft]=False And [met]=2 And [co_selected]=0
I would like to parse this and print on the same report like:
[co_main.co_ulke]='TURKEY'
[co_main.co_sehir]='ANKARA'
[co_microsoft]=False
[met]=2
[co_selected]=0

Any clues, help is much appreciated.Thanks in advance.

Alp
 
Add a text box to your report and set its control source to:
=[Filter]
Make sure it is fairly large or set to can grow.
 
Alp said:
I hope the subject makes sense with what I need to accomplish. I'm calling a
report via an unbound form which sets the Condition(s) for the report.
Partial (end part) code is:
DoCmd.OpenReport "rpt_co_main_contact", acViewPreview, , strWhere

The strWhere can get a bit lengthy having up to 6 conditions. I would like
to print the conditions on the report itself as well. A sample strWhere is:
[co_main.co_ulke]='TURKEY' And [co_main.co_sehir]='ANKARA' And
[co_microsoft]=False And [met]=2 And [co_selected]=0
I would like to parse this and print on the same report like:
[co_main.co_ulke]='TURKEY'
[co_main.co_sehir]='ANKARA'
[co_microsoft]=False
[met]=2
[co_selected]=0


In the code that constructs the strWhere string add some
more statements to contruct the string you want to display
(use vbCrLf instead of 'And'). Then stuff that string into
a hidden text box on the form.

With that in place, the report can display the conditions
string in a text box by using the expression:
=Forms!theunboundform.thehiddentextbox
 
Thanks Marsh, but the problem is; the form gets closed one line above the
DoCmd.OpenReport with DoCmd.Close :-(

Maybe I can leave it open and just close it from the report's OnClose event.
I'll try that.

Alp

Marshall Barton said:
Alp said:
I hope the subject makes sense with what I need to accomplish. I'm calling
a
report via an unbound form which sets the Condition(s) for the report.
Partial (end part) code is:
DoCmd.OpenReport "rpt_co_main_contact", acViewPreview, , strWhere

The strWhere can get a bit lengthy having up to 6 conditions. I would like
to print the conditions on the report itself as well. A sample strWhere
is:
[co_main.co_ulke]='TURKEY' And [co_main.co_sehir]='ANKARA' And
[co_microsoft]=False And [met]=2 And [co_selected]=0
I would like to parse this and print on the same report like:
[co_main.co_ulke]='TURKEY'
[co_main.co_sehir]='ANKARA'
[co_microsoft]=False
[met]=2
[co_selected]=0


In the code that constructs the strWhere string add some
more statements to contruct the string you want to display
(use vbCrLf instead of 'And'). Then stuff that string into
a hidden text box on the form.

With that in place, the report can display the conditions
string in a text box by using the expression:
=Forms!theunboundform.thehiddentextbox
 
Thanks Duane,

I'll try your suggestion and also see if I can parse that field into a few
lines as well.

Alp

Duane Hookom said:
Add a text box to your report and set its control source to:
=[Filter]
Make sure it is fairly large or set to can grow.

--
Duane Hookom
MS Access MVP
--

Alp Bekisoglu said:
Hi Experts,

I hope the subject makes sense with what I need to accomplish. I'm
calling a report via an unbound form which sets the Condition(s) for the
report. Partial (end part) code is:
DoCmd.OpenReport "rpt_co_main_contact", acViewPreview, , strWhere

The strWhere can get a bit lengthy having up to 6 conditions. I would
like to print the conditions on the report itself as well. A sample
strWhere is:
[co_main.co_ulke]='TURKEY' And [co_main.co_sehir]='ANKARA' And
[co_microsoft]=False And [met]=2 And [co_selected]=0
I would like to parse this and print on the same report like:
[co_main.co_ulke]='TURKEY'
[co_main.co_sehir]='ANKARA'
[co_microsoft]=False
[met]=2
[co_selected]=0

Any clues, help is much appreciated.Thanks in advance.

Alp
 
Back
Top