Passing data from one control to another

G

Guest

Let's say I have two forms open - frmA and frmB. After a button on frmA is clicked, how would I pass a value (string) from one textbox on frmA to another textbox on frmB? Thanks.
 
J

Jim Allensworth

Let's say I have two forms open - frmA and frmB. After a button on frmA is clicked, how would I pass a value (string) from one textbox on frmA to another textbox on frmB? Thanks.

You can refer to it through the forms collection like...

Forms!frmB!txtToReceive = Me.txtSend


- Jim
 
C

Chris

Ken this should work for you. Apply this code to your
command button's OnClick Event Property.

Private Sub cmdTestBtn_Click()
[Forms]![formB]![txt1] = [Forms]![formB]![txt1]
End Sub

chris a.k.a.

TheOriginalStealth
-----Original Message-----
Let's say I have two forms open - frmA and frmB. After
a button on frmA is clicked, how would I pass a value
(string) from one textbox on frmA to another textbox on
frmB? Thanks.
 
J

John Thomas

Since the code is running in response to a button on
FormA, you need to fully reference FormB and its textbox
control. This should work...
Forms!frmYourForm.txtYourTextBox = strFormAValue
-----Original Message-----
Let's say I have two forms open - frmA and frmB. After a
button on frmA is clicked, how would I pass a value
(string) from one textbox on frmA to another textbox on
frmB? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top