related question concerning Access reports and VB modules

A

AdamY05

If I have a function in a module that generates variables and then
calls a report, can I reference those variables in the report
directly, without having to write them to a table or elsewhere first?
For instance, in a text box within the report design view, can I enter
a text box control source as: function([variablename]) ?

Basically, the purpose of the function is to scan various tables for
data problems and then keep track of occurences. Since I did wrote
that code directly in VB without using queries or SQL, i'd prefer not
to have to redo it. And the variables are already populated, so it
seems trivial to just call them into a report.

Thanks in advance.
 
M

Marshall Barton

AdamY05 said:
If I have a function in a module that generates variables and then
calls a report, can I reference those variables in the report
directly, without having to write them to a table or elsewhere first?
For instance, in a text box within the report design view, can I enter
a text box control source as: function([variablename]) ?

Basically, the purpose of the function is to scan various tables for
data problems and then keep track of occurences. Since I did wrote
that code directly in VB without using queries or SQL, i'd prefer not
to have to redo it. And the variables are already populated, so it
seems trivial to just call them into a report.


Well, yes, you can do that kind of thing, but you will have
to write your own function to "scan" the variables. You can
not actually search your module for VBA variables by using
string with a variable name, so your function will need a
Select Case statement with a separate Case for each
variable.

I think it would be a whole lot simpler to use a Collection
instead of a bunch of variables.
 

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