Last record of Access form not updating in table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lynch225
    New Member
    • Jan 2012
    • 43

    Last record of Access form not updating in table

    Hello all,
    I have an issue with a form updating all records in a table except for the very last record for some reason.

    A little background, I have an unmatched query that appends results to a table so that the records are updateable. I have a form that is based on this table, where the user updates the invalid fields on a form, and then an update query is ran to update the records in the master table. All of this works great, except for the last record on the form. I can't figure out for the life of me why this is the case. Even when I hit enter after changing the records, the table is not updating.

    Does anyone have an idea? I assume it's an easy fix but it's making my brain hurt.

    Thank you all!
  • dsatino
    Contributor
    • May 2010
    • 393

    #2
    Why not just set the .recordsource of the form to the table and bind the form fields to appropriate table fields. Then you're editing the records directly and don't need the update query.

    Basically, you're adding an extra step that's not necessary.

    Comment

    • Lynch225
      New Member
      • Jan 2012
      • 43

      #3
      Thanks for the response dsatino...

      I should have clarified. I have a form bound to a table, as you suggested. As I update the form, the resulting fields in the table will also update. This works for all records except for the last record for some reason. I then take this table and run an update query to update these specific records into a larger table. I guess I did not need to specify this...

      So if the form is bound to the table, why would all records update correctly except the last one? I am confused.

      Thanks!

      Comment

      • dsatino
        Contributor
        • May 2010
        • 393

        #4
        Is the record failing to update in the form bound table, or just in the 'larger' table?

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Why the extra step?
          Why not bind the form to the larger table to begin with?
          You can then use the form's (or control level if needed) before_update event to validate the record before the edit is saved.

          Comment

          • Lynch225
            New Member
            • Jan 2012
            • 43

            #6
            Thank you for the responses...

            The record is not updating in the bound table, so it's not an issue with the update query.

            As far as the reasoning behind not having the form bound to the larger table is that:
            1.) I run an unmatched query, which basically shows which records are invalid for a single field. One table imports data from our labor management (non-Access) database. Employees choose certain labor codes to use, so quite often they type in a labor code that does not exist, so the unmatched query finds invalid codes by matching the labor data against a table with all valid codes. The query is then unable to be updated, so that why I chose to append that table to a writable table and update it from there.
            2.) The form and bound table are located on a front end, with the large table on a backend. I use this so multiple managers can pull hours at any time and get the most recent hours. I didn't want to have the form on the backend for obvious reasons

            Hopefully this helps explain my problem and reasoning a little more. I will continue to try workarounds, but any help is always helpful!

            Comment

            • dsatino
              Contributor
              • May 2010
              • 393

              #7
              It's probably much simpler than you think. It sounds like the last record isn't updating because the control update event isn't being triggered.

              My guess is that your form is continuous and that hitting the enter button moves to the next record, which does trigger the event. On the last record, there is no where to go and so the enter button does nothing.

              I'd bet that if you simply take the cursor and select any previous record on the form after you've changed the last record then you'll find that it updates to the table successfully.

              Comment

              • Lynch225
                New Member
                • Jan 2012
                • 43

                #8
                Thanks again dsatino...

                You were definitely right about pointing the cursor at a previous record for it to update- worked like a charm last night. Of course, when I ran this morning there was only 1 record that showed up haha. I just made a temporary change by changing the Allow Additions property to yes so hitting enter will move to a new record and update the table accordingly.

                Much appreciated!

                Comment

                Working...