Results 1 to 7 of 7
  1. #1
    vazdajic is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    95

    How can I make a button (on click) to copy text from textbox on one form to textbox on second form

    Hello!



    Before I pop the question, I have following:
    Form: LOCATION and on it textbox named LOCATION and a button named COPY
    Form: DESTINATION and on it textbox named DESTINATION

    Question is:

    I want COPY button (on click) to copy text written in textbox named LOCATION to textbox named DESTINATION
    How can I make it work (NOTE: at the same time both forms will be open)

    Click image for larger version. 

Name:	COPY PASTE TEXTBOX.jpg 
Views:	12 
Size:	100.5 KB 
ID:	23859

  2. #2
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    In On Click event of button:

    Forms("DESTINATION").Destination = Me.Location

    But... you should really consider changing naming convention to avoid confusion. You have form named DESTINATION and txtbox on it named DESTINATION. Maybe try frmDestination and txtDestination? That would make your design more clear and easier to track potential bugs.

  3. #3
    vazdajic is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    95
    It Works!!!!!!!!!!!!!!!

    Thanks!!!!!!!!!!!!!!!!

  4. #4
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Did you even try? There wasn't any code in what you uploaded.
    There is now exactly as I advised and it works:

    COPY PASTE TEXT.zip

    Edit:
    Whoa, sneaky ninja edit? At least leave previous version of your post to not confuse readers ;>

  5. #5
    vazdajic is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    95
    Aha.. Ok, I will leave previous posts untouched.. Thanks for an advice..

    Anyway, after renaming forms and textboxes, It works as an ONCLICK button VBA event:

    Private Sub COPY_Click()
    Forms("FORM_DESTINATION").TEXT_DESTINATION = Me.TEXT_LOCATION
    End Sub

    Thank you very much..

    One additional question.. It works perfect if both forms are open (I wanted it that way).
    Can the button be ordered to first open the second form and then copy/paste the text from first form's textbox?

  6. #6
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Code:
    Private Sub COPY_Click()
        DoCmd.OpenForm ""FORM_DESTINATION"
        Forms("FORM_DESTINATION").TEXT_DESTINATION = Me.TEXT_LOCATION
    End Sub

  7. #7
    vazdajic is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    95
    Thanks, this works ( there was just one extra " )

    Thank you )))))))))))

    Private Sub COPY_Click()
    DoCmd.OpenForm "FORM_DESTINATION"
    Forms("FORM_DESTINATION").TEXT_DESTINATION = Me.TEXT_LOCATION
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. On Button Click, Record Date & Time to a Textbox
    By JakeMurray27 in forum Programming
    Replies: 2
    Last Post: 02-20-2016, 04:22 AM
  2. Replies: 2
    Last Post: 01-26-2016, 08:08 AM
  3. Replies: 1
    Last Post: 09-29-2015, 02:25 AM
  4. Replies: 3
    Last Post: 10-16-2011, 02:51 PM
  5. Replies: 8
    Last Post: 05-26-2011, 09:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums