Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy 1 field paste to another 2

Status
Not open for further replies.

saraann422

Technical User
Apr 17, 2008
21
0
0
US
I have a form where 1 field may equal a previously entered field on the same form. Is there a way to create a button, that when you click it, it will copy the data from Field 1 and paste it into Field 2?

Thank you!
Sarah
 
Yes. Something like:

Code:
Private Sub CopyControl_Click()
  Me.txtTextboxB=Me.txtTextboxA
End Sub

By the way, forms have controls, tables have fields.
 
Also, by the way, why are you storing the same data in two different fields? The purpose of a relational database like Access is not to have duplicate data. Are your tables normalized?
 
Thanks, i'll give that a shot!

There's a 50/50 chance the info in the second control will have different data.
 
Where would I add this? (Sorry, this is my first time trying to add this kind of thing.)

Private Sub CopyControl_Click()
Me.txtTextboxB=Me.txtTextboxA
End Sub

And how would it read if I want to copy from "Client#" on Form1 to "Cust#" on Form1?

Thank you!
 
Create a button in Form1.
Then create the Click event procedure (follow the ellipsis (...))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top