Can I do this using the expression builder from the textbox?
How to import data from one form to another form
Collapse
X
-
I'm going to give you a qualified "yes", with the thought that you don't really mean "import from one form to another" but "reference an object on one form from another form that is open at the same moment"
Just navigate in the expression builder in the left hand frame under Forms and drill down to the form you want. That will give you the list of available objects on that form.
It's easier if you make sure the form is open at that time so you can find the form under "Loaded forms"; avoids the need to search a potentially long list under "All Forms."
Note the coding that the builder comes up with and in the future you may find it easier to just type it yourself. It will be something like Forms!formname! objectname!even torproperty.
You can change the color of objects on the other form or retrieve a value and maybe even fire an event on the other form and lots of other cool stuff.
Jim -
Thanks, Jim and yes I would like to retrieve a value instead. Does the same process apply?I'm going to give you a qualified "yes", with the thought that you don't really mean "import from one form to another" but "reference an object on one form from another form that is open at the same moment"
Just navigate in the expression builder in the left hand frame under Forms and drill down to the form you want. That will give you the list of available objects on that form.
It's easier if you make sure the form is open at that time so you can find the form under "Loaded forms"; avoids the need to search a potentially long list under "All Forms."
Note the coding that the builder comes up with and in the future you may find it easier to just type it yourself. It will be something like Forms!formname! objectname!even torproperty.
You can change the color of objects on the other form or retrieve a value and maybe even fire an event on the other form and lots of other cool stuff.
JimComment
-
Just to be clear. Am I doing this under the Data tab using the control source property?I'm going to give you a qualified "yes", with the thought that you don't really mean "import from one form to another" but "reference an object on one form from another form that is open at the same moment"
Just navigate in the expression builder in the left hand frame under Forms and drill down to the form you want. That will give you the list of available objects on that form.
It's easier if you make sure the form is open at that time so you can find the form under "Loaded forms"; avoids the need to search a potentially long list under "All Forms."
Note the coding that the builder comes up with and in the future you may find it easier to just type it yourself. It will be something like Forms!formname! objectname!even torproperty.
You can change the color of objects on the other form or retrieve a value and maybe even fire an event on the other form and lots of other cool stuff.
JimComment
-
this is the code that I have in the control source property: =Forms!frmMSFee s!WFFeesTotal
I'm getting an error messageComment
-
Hmm, now that's a construction I would not have thought of. Very clever. Hmmmm ... well, I don't know if you can do that or not. Moreover, I don't know how that would be practical. When form frmMSFees changes, you would need something to fire this form to read the change, which I suppose could be an afterUpdate event, maybe.
You don't say what your error is, so it's impossible to make any comment about that. Maybe the other form is not loaded, maybe Access doesn't like this in a control source.
Normally, for me anyway, when form B is reading something from form A, form B has been opened by form A, either as a subform of form A or a pop-up window doing some specific task related to form A. Like, I have several forms with a credit card button, and if the user hits the credit card button on any of these forms, they all launch the credit card data entry pop-up form. It figures out which main form is open and from that figures out which customer it is getting the credit card data for editing and submission for authorization.
So, usually, I'm saying somethng like this (on form B) in response to some event on form B, which was likely opened by form A:
and maybe I'll follow that with additional data collection from form A to form B before form B does something useful, then closes and the user is returned to form A.Code:me!txt123 = Forms!frmA!txt456
So it would be useful to know what you are doing. What is the purpose of transferring this data from form MSFees to form B? If you want the data on form B to track along with the data on form MSFees, maybe it would be better to make form B a subform (a form within a form) of MSFees, and link the two forms with a master/child key relationship. That way, when you change records on form A, the data on form B is automatically changed to show a corresponding record.
For instance, on a Customer screen, form A might have the name, address, salesman, terms and so on for the customer, and form B might have all the open orders for that customer. As soon as you change customers on the customer master form, of course you want the subform showing data related to the newly selected customer.
So what is your situation? What are doing and how does form B relate to MSFees?
One more thing, keep in mind that when you put a formula in a data source, you are making that text box (or whatever the object is) read-only, it is for viewing only. Obviously you can't change the data because the control source is not a data item or blank.
JimComment
Comment