SetValue action in a Macro

M

maria.lazarova

Hi,
I am trying to create a macro to print out a report for a specific
department's activity. I'd like to open the report, set the value on
specific field for this particular department and print it out.

I am having trouble with the SetValue field and am not sure what I do
wrong.

In the Item field I have [Reports]![Monthly Report]![DepartmentID]
In the Expression field I have [Reports]![Monthly Report]!
[DepartmentID]=38452

38452 is the Department ID I want to print the report for.

When I run the Macro it stops midway and gives me a message "Action
Failed - Action name SetValue". I have to press Halt and then the
report opens for all departments, without any filter.

I'd appreciate any suggestions.
Thank you,
Maria
 
K

Ken Snell \(MVP\)

You cannot use SetValue action to set the value of a control in a report.
Reports do not allow you to change the value of controls from outside the
report.

What you need to do is use a query for the report that returns all
departments' data records, then filter the report (OpenReport action, Where
argument) to show just the records for the desired department value. Then be
sure to bind that textbox in the report to the department field.
 

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