locked
Copying field values from one record to another RRS feed

  • Question

  • Hi all,

    I have a table with LotNumber (Text field) as the Primary Key and with fields: field1, field2 and field3 (also Text fields).

    On a form in Single Form view, I would like to copy the values of field1, field2 and field3 for a particular LotNumber (currently displayed) to another LotNumber selected by ComboSelectLot on a pop-up form via a command button on that pop-up form.

    Can someone please help?

    Thank you.

    Mark

    Tuesday, June 7, 2016 5:15 PM

Answers

  • Problem solved ... well, at least one way.

    Just ran 4 saved queries (DoCmd.OpenQuery ... SetWarnings False & then back to True at the end) in the button's On Click event.

    One query to delete the contents of a temp table. (5 queries, if you include the initial Make-Table query, which I only used once).

    One query to fill (append) the empty temp table with the row of info I want to copy to another lot.

    One update query to change the LotNumber in the temp table to the one that the info is going to be copied to.

    And a second update query that links the temp table to the main LotNumber table via the now-matching LotNumber fields, and which then transfers the data for the rest of the fields from the temp table.

    And, oh yeah, a serious warning on the pop-up form to make sure to select the correct LotNumber to copy to, so as not to copy the data to the wrong lot. That would be bad.

    Anyhow, works like a charm.

    Mark


    • Edited by mdavisfps Wednesday, June 8, 2016 2:34 AM
    • Marked as answer by mdavisfps Wednesday, June 8, 2016 2:35 AM
    Wednesday, June 8, 2016 2:33 AM

All replies

  • Problem solved ... well, at least one way.

    Just ran 4 saved queries (DoCmd.OpenQuery ... SetWarnings False & then back to True at the end) in the button's On Click event.

    One query to delete the contents of a temp table. (5 queries, if you include the initial Make-Table query, which I only used once).

    One query to fill (append) the empty temp table with the row of info I want to copy to another lot.

    One update query to change the LotNumber in the temp table to the one that the info is going to be copied to.

    And a second update query that links the temp table to the main LotNumber table via the now-matching LotNumber fields, and which then transfers the data for the rest of the fields from the temp table.

    And, oh yeah, a serious warning on the pop-up form to make sure to select the correct LotNumber to copy to, so as not to copy the data to the wrong lot. That would be bad.

    Anyhow, works like a charm.

    Mark


    • Edited by mdavisfps Wednesday, June 8, 2016 2:34 AM
    • Marked as answer by mdavisfps Wednesday, June 8, 2016 2:35 AM
    Wednesday, June 8, 2016 2:33 AM
  • Hi mdavisfps,

    Thanks for sharing.

    If you have any other issues, please feel free to post in this forum.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, June 8, 2016 2:54 AM
  • Just a footnote:

    Just in case of accidently copying info to the wrong LotNumber, I created a history table to which the targeted LotNumber info is appended, prior to overwriting with the new info. A history report allows changing the info back to what is was.

    Mark

    Wednesday, June 8, 2016 10:10 AM