conditions on a report

M

Miskacee

I have a filter on a form and a button to generate a report. I have 3
choices of which to filter by. If I want to show only one of the choices on
the report, for example, customer service rep name (this is how I filter the
form) how do I create conditions on a report to show only that column? The
other choices may be depart, location. If I filter by Customer Service Rep,
then I would not want to show dept or location since i only filtered on
Customer service rep. I am showing this at the header area of the report so
the user can see how the report was created - by what filter. Other times, I
may only want to filter by Dept but there are the other 3 fields at the top
of the header also but only want to show the dept and not the other 2.

In other words, I would like to make 2 fields invisible while only one field
is visible on the header, depending upon how the report is filtered. Any
suggestions?

Thank you!!
 
A

Albert D. Kallal

Lets assume your filter on the form is option group with 3 choices

(you don't menton how you do this)

Simply place some code in the on-format event of the reprot.

if forms!MyReportPrompt.OptionGroup = 1 then
me.lblDepart.visible = true
end if

etc. etc. etc..

So, just use some code in the on-format that looks at the values used in
your form used for prompting...
 
M

Miskacee

Thank you very much! I will try that to relay it to my 3 choices - drop down
list boxes of names/items to select from. What would be: myReportPrompt?
If you have time, can you document the code for the drop down list boxes? I
think I know how to do it but am not cetain. Thank you for your help.
 
A

Albert D. Kallal

Thank you very much! I will try that to relay it to my 3 choices - drop
down
list boxes of names/items to select from.
What would be: myReportPrompt?

That would be the name of your form (I called my report prompt because it's
probably some form that prompts the user for some values).

I'm sure you'll replace it with the name of your form is. I'm reasonably
intelligent but I certainly cannot guess your forms names!!!

note that in all of access all and most coding examples you'll see the
following kinds of syntax :

forms!nameofform!nameoffield

The first part is forums , then the ! mark, and then the name of the form,
then !, then name a field.
If you have time, can you document the code for the drop down list boxes?
I
think I know how to do it but am not cetain. Thank you for your help.

It's not quite clear how you set up to drop down boxes, And what actual
value for the combo boxes
you're going to test for. .

but, your code will look something like

if forms!NameOfYourform!NameOfYourcombobox = somevalue then
 
M

Miskacee

Thanks - I understand the ! and use forms!formName!field on a regular
basis.Let me try again to explain: After trying to write how to explain, I
figure it is way to hard to explain and would be much better at showing and I
can't attach anything. If you have an email address, I can send the info to
you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top