Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Table to Table Update With VBA

Discussion in 'Information Technology' started by Mike W, Nov 5, 2005.

Tags:
  1. Mike W

    Mike W
    Expand Collapse
    Guest

    I am trying to update a table with values from another table, based upon an
    entry on a form. I would appreciate suggestions on this.

    Thanks
    Mike
     
  2. Loading...

    Similar Threads Forum Date
    As A Child, Public Marches Of Sikhism Made Me Uncomfortable. They Still Do . Why ? Whats The Logic Hard Talk Oct 16, 2016
    Arts/Society Backyard Vegetable Garden Language, Arts & Culture Dec 27, 2013
    Heritage Now a Vegetable Market, Ranjit Singh's Royal Haveli a Picture of Neglect History of Sikhism Nov 11, 2013
    Sikhism Helium: 1984 and the "Periodic Table of Hate" (Jaspreet Singh) Book Reviews & Editorials Oct 28, 2013
    Heritage How our entire history was dumped in a horse stable History of Sikhism Oct 28, 2013

  3. Arvin Meyer [MVP]

    Arvin Meyer [MVP]
    Expand Collapse
    Guest

    On the click event of a command button, or in the after update event of the
    form, write a piece of code like (aircode):

    DoCmd.RunCommand acCmdSaveRecord
    CurrentDb.Execute "INSERT INTO Table2 SELECT * FROM Table1 Where ID=" &
    Me.txtRecordID

    txtRecordID is the ID value of the key
    --
    Arvin Meyer, MCP, MVP
    Microsoft Access
    Free Access downloads
    http://www.datastrat.com
    http://www.mvps.org/access


    "Mike W" wrote:

    > I am trying to update a table with values from another table, based upon an
    > entry on a form. I would appreciate suggestions on this.
    >
    > Thanks
    > Mike
     
  4. tina

    tina
    Expand Collapse
    Guest

    off-hand, and in general, i can think of two ways to do it. 1) in the form's
    module, open a Recordset of the table you want to update, and then add or
    edit the record(s) in the recordset. if the table that has the values is not
    bound to the form, then you'll need to open another Recordset first, to
    access that data. 2) create a Select query to pull the data you want to
    update into the other table. then turn the query into an Append query. if
    you want to edit data in the receiving table, rather than appending new
    records, you'll need to go about it differently.

    if you want specific, on-target information, then post specific information
    about your tables, and the form, and exactly what you're trying to do - add
    records? or update records?

    hth


    "Mike W" <MikeW@discussions.microsoft.com> wrote in message
    news:AE8BD1FF-7718-418D-AD63-26A68ACDDE3E@microsoft.com...
    > I am trying to update a table with values from another table, based upon

    an
    > entry on a form. I would appreciate suggestions on this.
    >
    > Thanks
    > Mike
     
  5. Mike W

    Mike W
    Expand Collapse
    Guest

    I have created a table for storing customer return data, and a simple form
    that the customer service manager will use to enter roughly four pieces of
    information to open a work request. To start with he will click a command
    button to open a new record and then fill in specific information. The text
    windows of this form are bound to the data table. One text window is for the
    product type and based on the type, I want to extract parameters from a
    different table and update the current record with this data before closing
    out the data entry session. This updated data is will be used to populate
    the repair worksheet form.

    Thanks,
    Mike

    "tina" wrote:

    > off-hand, and in general, i can think of two ways to do it. 1) in the form's
    > module, open a Recordset of the table you want to update, and then add or
    > edit the record(s) in the recordset. if the table that has the values is not
    > bound to the form, then you'll need to open another Recordset first, to
    > access that data. 2) create a Select query to pull the data you want to
    > update into the other table. then turn the query into an Append query. if
    > you want to edit data in the receiving table, rather than appending new
    > records, you'll need to go about it differently.
    >
    > if you want specific, on-target information, then post specific information
    > about your tables, and the form, and exactly what you're trying to do - add
    > records? or update records?
    >
    > hth
    >
    >
    > "Mike W" <MikeW@discussions.microsoft.com> wrote in message
    > news:AE8BD1FF-7718-418D-AD63-26A68ACDDE3E@microsoft.com...
    > > I am trying to update a table with values from another table, based upon

    > an
    > > entry on a form. I would appreciate suggestions on this.
    > >
    > > Thanks
    > > Mike

    >
    >
    >
     
  6. tina

    tina
    Expand Collapse
    Guest

    > One text window is for the
    > product type and based on the type, I want to extract parameters from a
    > different table and update the current record with this data before

    closing
    > out the data entry session.


    if the parameters are in the same table as the product type that you're
    referring to, and if the product type *control* (that's the correct name for
    a "text window" in a form) is a combo box whose RowSource is based on the
    product types table, then you can simply add additional columns to the combo
    box to pull those parameters, and then set the value of the controls in your
    form to those parameters. in the combo box's AfterUpdate event, use a
    SetValue action in a macro or VBA, something along the lines of

    Me!MyTextboxControlName = Me!ComboboxControlName.Column(n)

    (n) refers to the index number of the column. since combobox column index is
    zero-based, the first column (in left-to-right order) is 0, the second
    column is 1, the third column is 2, etc.

    hth


    "Mike W" <MikeW@discussions.microsoft.com> wrote in message
    news:F3BC2EE6-04A0-46EF-9EFA-E6A92ED2DEFF@microsoft.com...
    > I have created a table for storing customer return data, and a simple form
    > that the customer service manager will use to enter roughly four pieces of
    > information to open a work request. To start with he will click a command
    > button to open a new record and then fill in specific information. The

    text
    > windows of this form are bound to the data table. One text window is for

    the
    > product type and based on the type, I want to extract parameters from a
    > different table and update the current record with this data before

    closing
    > out the data entry session. This updated data is will be used to populate
    > the repair worksheet form.
    >
    > Thanks,
    > Mike
    >
    > "tina" wrote:
    >
    > > off-hand, and in general, i can think of two ways to do it. 1) in the

    form's
    > > module, open a Recordset of the table you want to update, and then add

    or
    > > edit the record(s) in the recordset. if the table that has the values is

    not
    > > bound to the form, then you'll need to open another Recordset first, to
    > > access that data. 2) create a Select query to pull the data you want to
    > > update into the other table. then turn the query into an Append query.

    if
    > > you want to edit data in the receiving table, rather than appending new
    > > records, you'll need to go about it differently.
    > >
    > > if you want specific, on-target information, then post specific

    information
    > > about your tables, and the form, and exactly what you're trying to do -

    add
    > > records? or update records?
    > >
    > > hth
    > >
    > >
    > > "Mike W" <MikeW@discussions.microsoft.com> wrote in message
    > > news:AE8BD1FF-7718-418D-AD63-26A68ACDDE3E@microsoft.com...
    > > > I am trying to update a table with values from another table, based

    upon
    > > an
    > > > entry on a form. I would appreciate suggestions on this.
    > > >
    > > > Thanks
    > > > Mike

    > >
    > >
    > >
     

Share This Page