D
Dennis
Hi,
This is the second time I've asked this questions I this forum. I
understood the answer I received and have implemented it, but I see some
issues with it.
The question is how do I return varirables from external forms? For
example, I have a form that is called by a report. This form gets the report
parameters and returns the variables to the report using a global variable.
The global variables are set to null in the report, the form sets the values
for the global variables, and the report uses the variables.
When I asked the question, what is the "Access" way to return variables, I
was told the appropriate way was:
strLocalVariable = forms!frm_Name!txtControlName
I've written another report and parameter form using this technique and it
works fine.
Here is what botther me.
Using the global variable approach, the external form and the report are
"loosly coupled" (not sure if correct term). That is, if I changed the name
of the external form all I have to do is change one entry in the report and
everything is done. (I could get around this by storing all of the external
names in a table and have each form / report read the names from the table.)
For example, I change the name search form name from frm_Search_Cust to
frm_Cust_Search.
Using the form method it seems that I have tightly coupled the two progams.
Not only am I referencing the program name, I'm now directly accessing
variable names within that form! As I understand it, I would have to change
each varirable reference to use the new form name. In addition, if I change
the control names I now have to change all of the reference to that form
name. It seems like this adds a lot of potential maintence.
1. Is using global variables a bad thing in this specific circumstance and
use?
2. Is there a way to use the forms statement where I can indirectly access
the variables (so I can change the variable names without having to change
all of the cord in external programs that references those variables.).
I hope I phrased my question correctly and have provided enough information
for everyone.
Thanks,
Dennis
This is the second time I've asked this questions I this forum. I
understood the answer I received and have implemented it, but I see some
issues with it.
The question is how do I return varirables from external forms? For
example, I have a form that is called by a report. This form gets the report
parameters and returns the variables to the report using a global variable.
The global variables are set to null in the report, the form sets the values
for the global variables, and the report uses the variables.
When I asked the question, what is the "Access" way to return variables, I
was told the appropriate way was:
strLocalVariable = forms!frm_Name!txtControlName
I've written another report and parameter form using this technique and it
works fine.
Here is what botther me.
Using the global variable approach, the external form and the report are
"loosly coupled" (not sure if correct term). That is, if I changed the name
of the external form all I have to do is change one entry in the report and
everything is done. (I could get around this by storing all of the external
names in a table and have each form / report read the names from the table.)
For example, I change the name search form name from frm_Search_Cust to
frm_Cust_Search.
Using the form method it seems that I have tightly coupled the two progams.
Not only am I referencing the program name, I'm now directly accessing
variable names within that form! As I understand it, I would have to change
each varirable reference to use the new form name. In addition, if I change
the control names I now have to change all of the reference to that form
name. It seems like this adds a lot of potential maintence.
1. Is using global variables a bad thing in this specific circumstance and
use?
2. Is there a way to use the forms statement where I can indirectly access
the variables (so I can change the variable names without having to change
all of the cord in external programs that references those variables.).
I hope I phrased my question correctly and have provided enough information
for everyone.
Thanks,
Dennis