Copying between subforms, help please.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • radioman

    Copying between subforms, help please.

    Hi all, I would appreciate some help please.
    I just need pointing in the right direction as I am at a loss.
    Basically I have a form (frmAddMaster) which displays two subforms
    "Master Stock subform" and "Client Stock Template subform".
    Each subform contains the following fields "Product ID,Product Description
    and Size".
    What I am trying to do is to select rows from the "Master Stock subform" and
    copy them
    to "Client Stock Template subform". I have created a macro which works but
    only for
    the "Product ID" field, it will not copy the rest of the row.
    However if I manually select a row in "Master Stock subform" using the
    cursor and then right click and
    select copy, then move to the "Master Stock subform", select "Paste Append"
    from the "Edit"
    menu it works fine, what I want to be able to do is to select the rows from
    "Master Stock subform"
    then click a command button to automate the cut and paste process, is this
    possible?

    Regards, Dave.


    --
    --


    radioman

    Please remove "spamnot" to reply.






  • Matthew Sullivan

    #2
    Re: Copying between subforms, help please.

    R-man:

    A clarification: you don't really move data from subform to subform;
    you move data from table to table. The subforms only display the
    data.

    Assuming that your subforms are based on different tables (implied in
    your description below), copying a record from one table to another
    can be done via a query. You just need to
    - create the query that copies the data
    - run the query at the appropriate time
    - requery the 2nd subform to show the new record

    You could maybe use "parameter query" (see help if you don't know
    about these).

    Give us more detail about your macro. It sound as if you're almost
    there.

    -Matt



    On Sat, 10 Apr 2004 15:13:41 +0100, "radioman"
    <spamnotradio.m an@ntlworld.com > wrote:
    [color=blue]
    >Hi all, I would appreciate some help please.
    >I just need pointing in the right direction as I am at a loss.
    >Basically I have a form (frmAddMaster) which displays two subforms
    >"Master Stock subform" and "Client Stock Template subform".
    >Each subform contains the following fields "Product ID,Product Description
    >and Size".
    >What I am trying to do is to select rows from the "Master Stock subform" and
    >copy them
    >to "Client Stock Template subform". I have created a macro which works but
    >only for
    >the "Product ID" field, it will not copy the rest of the row.
    >However if I manually select a row in "Master Stock subform" using the
    >cursor and then right click and
    >select copy, then move to the "Master Stock subform", select "Paste Append"
    >from the "Edit"
    >menu it works fine, what I want to be able to do is to select the rows from
    >"Master Stock subform"
    >then click a command button to automate the cut and paste process, is this
    >possible?
    >
    >Regards, Dave.
    >
    >
    >--[/color]

    Comment

    • radioman

      #3
      Re: Copying between subforms, help please.

      Hi Matt, thanks for the reply.
      Yes I understand that the subform is only displaying what is
      in tables and yes, there are two different tables.
      Perhaps a little background will make things clearer.

      My cousin runs his own business as a Stocktaker to the
      Licensed Trade and is using an old DOS based program which
      is no longer supported. I rather foolishly suggested I could write
      a replacement using Access for him to use, although I have had some
      experience with Access I am still very much a beginner, consequently my
      request for help.

      Basically the macro is trying to replicate the manual cut and paste
      operation.
      Macro Name: CopyItems
      Action: GoToControl Master Stock subform Select subform.
      Action: RunCommand Copy Copy selected data.
      Action: GoToControl Client Stock Template subform Select Client
      stock subform.
      Action: RunCommand PasteAppend Append to Client Stock Table.

      As I say this works but only for the first field "Product ID".


      --
      --


      radioman

      Please remove "spamnot" to reply.





      "Matthew Sullivan" <Matt@NoSpam.co m> wrote in message
      news:drcj70h2q9 ju50b07avb4hjr5 abcuicsa3@4ax.c om...[color=blue]
      > R-man:
      >
      > A clarification: you don't really move data from subform to subform;
      > you move data from table to table. The subforms only display the
      > data.
      >
      > Assuming that your subforms are based on different tables (implied in
      > your description below), copying a record from one table to another
      > can be done via a query. You just need to
      > - create the query that copies the data
      > - run the query at the appropriate time
      > - requery the 2nd subform to show the new record
      >
      > You could maybe use "parameter query" (see help if you don't know
      > about these).
      >
      > Give us more detail about your macro. It sound as if you're almost
      > there.
      >
      > -Matt
      >
      >
      >
      > On Sat, 10 Apr 2004 15:13:41 +0100, "radioman"
      > <spamnotradio.m an@ntlworld.com > wrote:
      >[color=green]
      > >Hi all, I would appreciate some help please.
      > >I just need pointing in the right direction as I am at a loss.
      > >Basically I have a form (frmAddMaster) which displays two subforms
      > >"Master Stock subform" and "Client Stock Template subform".
      > >Each subform contains the following fields "Product ID,Product[/color][/color]
      Description[color=blue][color=green]
      > >and Size".
      > >What I am trying to do is to select rows from the "Master Stock subform"[/color][/color]
      and[color=blue][color=green]
      > >copy them
      > >to "Client Stock Template subform". I have created a macro which works[/color][/color]
      but[color=blue][color=green]
      > >only for
      > >the "Product ID" field, it will not copy the rest of the row.
      > >However if I manually select a row in "Master Stock subform" using the
      > >cursor and then right click and
      > >select copy, then move to the "Master Stock subform", select "Paste[/color][/color]
      Append"[color=blue][color=green]
      > >from the "Edit"
      > >menu it works fine, what I want to be able to do is to select the rows[/color][/color]
      from[color=blue][color=green]
      > >"Master Stock subform"
      > >then click a command button to automate the cut and paste process, is[/color][/color]
      this[color=blue][color=green]
      > >possible?
      > >
      > >Regards, Dave.
      > >
      > >
      > >--[/color]
      >[/color]


      Comment

      • Matthew Sullivan

        #4
        Re: Copying between subforms, help please.

        R-Man:

        If I were doing it for myself, I'd use a Parameter Query.

        A Parameter Query would basically be a query that appends a record
        from the Master table into the Client table. You would give it a
        criterion for the Product ID. That criterion would be a reference to
        the Product ID of the selected record in on the Master subform, and
        would have a syntax like this:

        [Forms]![frm_TheParentFo rm]![chd_SubformCont rol]![txt_TheSubformC ontrol]

        See the Help for more info about Parameter Queries.

        -Matt



        On Mon, 12 Apr 2004 08:22:15 +0100, "radioman"
        <spamnotradio.m an@ntlworld.com > wrote:
        [color=blue]
        >Hi Matt, thanks for the reply.
        >Yes I understand that the subform is only displaying what is
        >in tables and yes, there are two different tables.
        >Perhaps a little background will make things clearer.
        >
        >My cousin runs his own business as a Stocktaker to the
        >Licensed Trade and is using an old DOS based program which
        >is no longer supported. I rather foolishly suggested I could write
        >a replacement using Access for him to use, although I have had some
        >experience with Access I am still very much a beginner, consequently my
        >request for help.
        >
        >Basically the macro is trying to replicate the manual cut and paste
        >operation.
        >Macro Name: CopyItems
        >Action: GoToControl Master Stock subform Select subform.
        >Action: RunCommand Copy Copy selected data.
        >Action: GoToControl Client Stock Template subform Select Client
        >stock subform.
        >Action: RunCommand PasteAppend Append to Client Stock Table.
        >
        >As I say this works but only for the first field "Product ID".
        >
        >
        >--[/color]

        Comment

        Working...