Consulting

Results 1 to 4 of 4

Thread: Copy Field from Main Form to Subform

  1. #1
    VBAX Regular
    Joined
    Jun 2020
    Posts
    15
    Location

    Copy Field from Main Form to Subform

    Hi,
    From the instructions in the link below I have made an example of how to copy data from main form into a suborm. This works just fine when you pressed the "Command 01" button.
    However, how could I do exactly the same example but to click on the Command 02 button, so that button is on main form? I am having a problem setting up a code??

    Can anyone write me a code?

    I have also attached an Access example.

    link: https://sites.google.com/site/sharep...ain-to-subform


    Thank you!
    Greg
    Attached Files Attached Files

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,192
    Location
    Before going in to how to do it, I have to ask why would you want to?
    The whole point of relational databases is to enter data once and then refer to it.
    That is what Queries are for, ie bringing together the data from various tables.

  3. #3
    VBAX Regular
    Joined
    Jun 2020
    Posts
    15
    Location
    Hi, I just figured out how to do it. This is the code:

    Forms!frm_Main.frm_sub_A.Form.aField_01 = Forms!frm_Main.Field_01
    Forms!frm_Main.frm_sub_A.Form.aField_02 = Forms!frm_Main.Field_02


    In fact, it’s just a test form so I understand how it works.
    In reality, I want to have similar input mask where, when a button is clicked, certain data (not all) is transferred to the general ledger.


    Thanks for the help so far

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,192
    Location
    You do not need the Subform, unless you want it for display purposes to do the transfer.
    It can be done directly to the table using a recordset.
    I use that to balance stocks when sales are made and that kind of work.
    Let me know if you want or need to do that kind of thing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •