Linking forms

paultri

Registered User.
Local time
Yesterday, 21:51
Joined
May 19, 2003
Messages
19
Is it possible to have a field in a form poplulated when something is entered in a field from another form?
 
=[Forms]!["Name of the other form"]!["Name of the field in other form"]
 
Lets say formA is the name of the form that has the info you want and formB is the name of the form that has the field where you want it to go.

Place code like this into an event on formA once that data has been entered:

Forms!formB!controltogetinfo=Me.fieldwithinfo


Or place this code into an event on formB to pull the information from formA:

Me.fieldneedinginfo=Forms!formA!controlwithinfo

Of course, replace formA, formB, controltogetinfo, fieldwithinfo,fieldneedinginfo, and controlwithinfo with the actual names of your own controls.

As to which event to place these code snippets into, that's up to you. You can attach them to the click event of a command button or the AfterUpdate event of a text or combo box. Up to you.
 
Would the same apply if the field was a subform of the original form? hope that made sense.

Paultri
 
No, if the field that has the info you want to copy to another location is on a subform you'd need to change the syntax. Let's say your subform is called subForm. Change the syntax like this:

Forms!formB!subForm.Form!controltogetinfo=Me.fieldwithinfo

and


Me.fieldneedinginfo=Forms!formA!subForm.Form!controlwithinfo
 
Last edited:

Users who are viewing this thread

Back
Top Bottom