D
Dennis
Hi,
I'm on Access via XP Office Pro.
How do I obtain values from an form that I run using the DoCmd.OpenForm.
Currently, I have the form opened by OpenForm setting values in global
variables. I have a standard set of global variables that are set by the
called form and retreived in the calling form (the one that ran the DoCmd).
I've read where I should not be using global variables.
For example, on my customer call log form, we record all of our incoming
calls as they happen. If one of those calls results in the creation of a
work order, I want to click on the Work Order button, have the work order
screen pop up, enter the work order information, and the have the work order
number returned to the call log form so I can put the work order number on
the call log row.
I also all the user to add item to the drop down list by double clicking on
the field. This causes the program to lauch the Add/Chg Form for the code.
The user can than add a new code to the table. I return this value back to
the data entry screen the combo box is set to this value when the user
returns to the data entry screen. This value is also returned via a global
variable.
What is the best or most appropriate way to return the variable from a
DoCmd.OpenForm form?
I've see where I set the variable in the external form. When the user
"closes" the external form, I should hide the form and then having the
calling program extract the variable from the form by using
Forms!ExternalFormNm!ControlName, and then have the calling form close the
close form.
The main problem I see with this approach is I have tightly coupled my
calling forms to my called form. If I ever change the form name or change
the control name, I have to go through all of my code and change it to
reflect the new names.
Any suggestions?
Thanks,
I'm on Access via XP Office Pro.
How do I obtain values from an form that I run using the DoCmd.OpenForm.
Currently, I have the form opened by OpenForm setting values in global
variables. I have a standard set of global variables that are set by the
called form and retreived in the calling form (the one that ran the DoCmd).
I've read where I should not be using global variables.
For example, on my customer call log form, we record all of our incoming
calls as they happen. If one of those calls results in the creation of a
work order, I want to click on the Work Order button, have the work order
screen pop up, enter the work order information, and the have the work order
number returned to the call log form so I can put the work order number on
the call log row.
I also all the user to add item to the drop down list by double clicking on
the field. This causes the program to lauch the Add/Chg Form for the code.
The user can than add a new code to the table. I return this value back to
the data entry screen the combo box is set to this value when the user
returns to the data entry screen. This value is also returned via a global
variable.
What is the best or most appropriate way to return the variable from a
DoCmd.OpenForm form?
I've see where I set the variable in the external form. When the user
"closes" the external form, I should hide the form and then having the
calling program extract the variable from the form by using
Forms!ExternalFormNm!ControlName, and then have the calling form close the
close form.
The main problem I see with this approach is I have tightly coupled my
calling forms to my called form. If I ever change the form name or change
the control name, I have to go through all of my code and change it to
reflect the new names.
Any suggestions?
Thanks,