posting data from one record into the next record

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Arli
    New Member
    • Sep 2008
    • 39

    posting data from one record into the next record

    I am using Access 2003.

    I have a form that has text boxes labeled Position 1 T1, Position 1 T2, Position 2 T1, and Position 2 T2. When I create a new record, I want the same values to save into the new record unless a yes/no check box is selected on the new record (I also would like to gray out the entry altogether for update unless the check box is selected-that I found). I have looked all through the properties and can find no way to do this.

    Any help is greatly appreciated.
  • Arli
    New Member
    • Sep 2008
    • 39

    #2
    I just had a thought on this (do not know if it would work):

    I think I could place a button on the form that would first record those fields as a number (i.e. numP1t1, numP1t2, numP2t1, numP2t2), then move to a new record and place those variables into the correct fields. I can gray out the area by using an IF statement on the check box.

    Would something like that work?

    Thanks

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32645

      #3
      A way to do this which would not be clumsy and not set the Dirty flag, would be to handle setting the defaults for the various controls depending on the CheckBox you mention.

      A default value only ever has an effect when the record is created.

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        There's a nice working sample database in the Access CookBook:

        The fifth sample (0905.mdb) is the one you need..

        Can recommend the book :-)

        Nic;o)

        Comment

        • Arli
          New Member
          • Sep 2008
          • 39

          #5
          That worked! Thanks for the help. I used the exact code from your example and a checkbox to clear it when needed. I also went out and got the book.

          Arli

          Comment

          • nico5038
            Recognized Expert Specialist
            • Nov 2006
            • 3080

            #6
            You're welcome.
            Always great to see that people want to improve their skills :-)

            Nic;o)

            Comment

            • Arli
              New Member
              • Sep 2008
              • 39

              #7
              I have one more question. I used the code almost verbatim from the example (chainging the names where needed). I was wondering if there is a way to do the same thing by tying multiple values to the same toggle switch? What I want the operators to be able to do is select the toggle switch and that one switch would pull all the data forward into the new form.

              Hopefully that makes sense.

              Thanks

              Comment

              • nico5038
                Recognized Expert Specialist
                • Nov 2006
                • 3080

                #8
                Hi Arli,

                In case of multiple (excluding) values the general approach is to use a frame with radio buttons, one for each value. Such a frame (see the toolbox symbol with the square and text top left) with round radio buttons will be an intuitive way for the user to select a value and the frame can be bound to the field holding the value.

                Getting the idea ?

                Nic;o)

                Comment

                • Arli
                  New Member
                  • Sep 2008
                  • 39

                  #9
                  I will give that a try. Another thing to note (I was just testing the form). The code pulls the data from the first form forward. I set the toggle buttons so that the operators cannot change them, then put a check box on the form to clear those fields if new data is required. When I check that, it clears out the fields and allows the input of new data. The problem is that now the code appears to not work (when I create a new record at this point, the old data from record 1 is pulled into record 3).

                  That is the reason for the previous question. Using radio buttons may help me on that (because I need two checkboxes).

                  Comment

                  • nico5038
                    Recognized Expert Specialist
                    • Nov 2006
                    • 3080

                    #10
                    Keep me posted. When you find no solution, then attach a small sample .mdb so I can check the form. (Use the [Edit] after posting your comment to add an attachment)

                    Nic;o)

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32645

                      #11
                      Originally posted by nico5038
                      (Use the [Edit] after posting your comment to add an attachment)
                      That's no longer necessary Nico.
                      To attach items to one of your posts you need to scroll down the page a little when posting (either originally or in an advanced edit screen) to the button that says Manage Attachments. Pressing on that leads you to a page where you can add or remove your attachments. It also lists the maximum file sizes for each of the allowed file types.

                      Comment

                      • Arli
                        New Member
                        • Sep 2008
                        • 39

                        #12
                        Here is a copy of the database. In the form, I disabled the toggle buttons because I want to pull the data forward until the NewSetup check box is selected. As it works now, when I enter data into the first record, it pulls it to the second record. Once I input the second record, I go to the third (it still pulls forward the data-but I think it still getting it from the first record). On the third record, I select the checkbox for the NewSetup, that then clears the data (but does nothing to the toggle switches). I input my new data. Click on new record (which should then pull the new data forward), and the fourth record shows data from the first record still. If you want to try it out, use the following data.

                        Select New Work Order
                        then enter anything for Part number
                        enter anything for Serial number
                        check that the box exhibits 100% coverage
                        Leave the pulled forward data in there.
                        enter a number for machine timer
                        enter a number for both badges.
                        click new work order

                        On this one, select the checkbox for First Part on new setup.
                        then follow the above instructions and enter numbers into the Position1T1-Position4T2 fields.
                        click new order.

                        It should pull forward the 1.1234 from the first record.

                        Sorry if I am to detailed in this. I want to duplicate it exactly.

                        Thanks for your help.
                        Attached Files

                        Comment

                        • nico5038
                          Recognized Expert Specialist
                          • Nov 2006
                          • 3080

                          #13
                          Attachment ?

                          :)

                          Nic:o)

                          Comment

                          • Arli
                            New Member
                            • Sep 2008
                            • 39

                            #14
                            I could have sworn it was there....yea, right. Doh!

                            Comment

                            • nico5038
                              Recognized Expert Specialist
                              • Nov 2006
                              • 3080

                              #15
                              The present mechanism will "store" the value that's present in the text field when the toggle button is pressed. Changed values won't change this default value. Only a deselect and selecting the toggle again will set the newly entered value to being carried forward.
                              When you want to carry forward the last entered value, then an additional function is needed that handles the AfterUpdate event of the text value.

                              I've created such a function and applied it to the first field "POSITION 1 T1" by adding the function call to the AfterUpdate event and placing the toggle name in the tag property. Guess you can handle the remaining fields :-)

                              Nico
                              Attached Files

                              Comment

                              Working...