Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2021
    Posts
    3

    Copy the value of a text box from one form to another form


    Sorry for my english but i'm from poland.
    I have a form called "Document" and attached to it as a sub-form - the "Details" form. This "Documents" form has another "Product" form. After pressing the button on the "Product" form, I want the name of the producer to be copied and pasted into the field on the "Details" form. The field with the product name is a text field on both forms.
    What the VBA code should look like, which I will attach to the button


    Click image for larger version. 

Name:	acces.jpg 
Views:	24 
Size:	144.7 KB 
ID:	45962

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You want code behind a main form to reference a subform? Must reference through the subform container control. I always name container different from the object it holds, like ctrDetails. So:

    Me.ctrDetails.Form.prod_name = Me.prod_name
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Aug 2021
    Posts
    3
    Sorry for my english but i'm from poland.
    I have a form called "Document" and attached to it as a sub-form - the "Details" form. This "Documents" form has another "Product" form. After pressing the button on the "Product" form, I want the name of the producer to be copied and pasted into the field on the "Details" form. The field with the product name is a text field on both forms.
    What the VBA code should look like, which I will attach to the button
    Click image for larger version. 

Name:	acces.jpg 
Views:	25 
Size:	144.7 KB 
ID:	45961

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Review the Similar Threads at the bottom of this page.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I am rather confused by your description of form/subform arrangement. Not sure which form is on which form. If the other threads on same topic don't resolve issue, suggest you provide your file for analysis. Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Join Date
    Aug 2021
    Posts
    3
    Thanks for help. I resolved my problem

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Quote Originally Posted by dominik@kartony24.eu View Post
    Thanks for help. I resolved my problem
    Well, please explain how you have and also any code used to do it.
    These forums are here to help others, so it might help someone else in the future, trying to do the same thing.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 2
    Last Post: 09-25-2019, 02:27 PM
  2. Replies: 5
    Last Post: 10-18-2018, 03:41 PM
  3. Replies: 6
    Last Post: 02-26-2016, 05:28 AM
  4. Replies: 1
    Last Post: 07-23-2011, 11:51 PM
  5. Replies: 3
    Last Post: 07-23-2011, 12:45 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