Assign Global Variable to TextBox Control Source

Some people actually answered you original questions but it looks like you missed the answer.

1. how do I specify a Global variable as the Control source for my text box either via VBA or direct?

You cannot directly specify a public variable as a control source. There is no syntax for that. With VBA, however, you can put code in either the Form_Current or Form_Load event routine to assert the public variable into the value of the text box.

2. Is if possible to directly set the Control Source of the text box to pick the PartName from the Active form???

If this is on a bound form and you want to save the part name with the rest of the record, you don't want the .ControlSource anywhere other than pointing to the underlying record. Again, you might do something in the Form_Load or Form_Current routines.

You should also note that if you are running code on a form so that you can pick up something, then the form that is running IS the ActiveForm and therefore, the control from which you wanted to pick up something had better be on that form. The ONLY time this isn't true is if you have an open but hidden form running a timer in the background or if you have code running from a general module that was called from the active form.
 

Users who are viewing this thread

Back
Top Bottom