Set value in a report

G

Guest

I have a menu with many buttons on it, each one applying a different filter
to the same report. I want to make the report reflect which filter they
chose to apply, activated by a macro, if possible.

Example: If they choose to filter results by date, I want the subtitle on
the report to say something like "by date."

Thanks for any help you can provide.
 
P

PC Datasheet

Add the following to each button's code"
Reports!NameOfReport!NameOfSubtitleTextbox = "By Date"
<Or whatever the button's filter does>
 
M

Marshall Barton

Kark said:
I have a menu with many buttons on it, each one applying a different filter
to the same report. I want to make the report reflect which filter they
chose to apply, activated by a macro, if possible.

Example: If they choose to filter results by date, I want the subtitle on
the report to say something like "by date."


I like to have an invisible, unbound text box on the form
for this kind of thing. Then each button's click event can
set the text box to whatever you want to describe as the
filter's description. (I have never used macros, but it
should just be a SetValue action.)

This way, the report's subtitle text box can use an
expression like:

=FORMS!themenuform.thetextbox

to display a description of whatever filter the button used.
 
G

Guest

I tried PC Datasheet's solution and it didn't work. As far as Marshall's, I
have no idea what that means. Sorry, I'm still learning, but thanks for
trying. Anyone else got any ideas?
 
P

PC Datasheet

Go to the code for the button that filters by date. After the line of code
that opens the report, add this line of code:
Reports!NameOfReport!NameOfSubtitleTextbox = "By Date"
NOTE:
1. You must put the name of your report where the above says "NameOfReport"
2. You must put the name of the subtitle textbox on your report where the
above says "NameOfSubtitleTextbox"
3. By Date must be enclosed in parantheses as shown
 
G

Guest

Alright, I took another look at this, and I realized I had read it wrong the
first time. There's no better way to say it than "You hit the nail right on
the head!" Awesome job, thanks a lot.
 

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