Solved Can't change variable within Access 2003 macro

September 24, 2013 at 05:08:07
Specs: Windows XP
I have an Access 2003 report that I need to export, to separate files for separate recipients. Currently, I do this by having separate copies of the report saved with individual filters – e.g., [Recipient]=”name 1” – and running a macro using “Output To” to export each file separately.

What I’d like to do (I think) is to have a single copy of the report with a filter like [Recipient]=[Name], and in a macro swap name1, name2, name3 etc. into [Name], so that it would read something like:

Set [Name] = “name1”;
Output report
Set [Name] = “name2”;
Output report

But I can’t find a way to change the value of [Name] from within a macro. Any ideas?

See More: Cant change variable within Access 2003 macro

Report •

September 24, 2013 at 05:18:19
✔ Best Answer
You could have a combobox or listbox with all the names populated into it, then when you select an entry, set the variable 'Name' to the text value of either the listbox or combodox then run output report

Eg for combobox

Recipient = combobox1.text
output report

in this way you can control which report should be output by just selecting the appropriate value in the combobox, and only having to run the report once.
There is no need for multiple lines of code.

Report •
Related Solutions

Ask Question