PLEASE HELP: Refresh columns displayed in a report from a quer
This worked out perfect! Thanks a LOT!
Good to hear that you were able to figure out the details
and get it working.
The amount of code could be reduced by naming the user
selectable text boxes on the form similar to the way they
are named in the report. Then you could use a loop instead
of having a block of code for each form text box.
Do you know anything about storing sub routines and SQL queries as column
values and executing them through VBA?
VBA code must be compiled before it can be executed.
Because that is a design time action, you can not put code
anywhere other than in a module.
You can use the Eval function to evaluate a text string that
is a valid expression. The expression has the same
limitations as a text box expression (eg. no VBA variables).
However, you can use public functions you have created in a
standard module in an expression. If you can figure out a
way to do what you want by just running a function, then you
can specify the name of a function in a Text table field and
use a line of code in an appropriate event to call the
Eval(rs!somefield & "()")
OTOH, SQL statements in a text string can be executed, so
you can put those in a table. The code to run an action
query could be:
Or, for Select queries, you would be more likely to want to
use them as a form's record source:
Me.RecordSource = rs!fieldwithSQLstatement
MVP [MS Access]