Results 1 to 3 of 3
  1. #1
    pratim09 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Apr 2011
    Posts
    30

    Form values getting auto updated at back end.

    I have a sub form with multiple records. i double click a record and open it to modify .I have a field called hours in the modification form where there is a check if hrs is > 24 throw a message or else do the moidfication with update statement.Problem is if I give hrs more than 24 and update its giving me the msg but behind in the subform I can see that the record value of hrs is already updated with the increased value. I know closing the form creates some problem like this and so I have disabled the close button in the form and my form has only update button and a close button(which undo the form and closes).



    Plz suggest how I stop this sort of auto updating ...

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    There are many things that can cause a form to save changes.
    Just moving from one record to a different record will cause the data to be saved.

    What code do you have in what events?

    I would think you would have code in the Form Before Update event to cancel the save if the hours is > 24.

  3. #3
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    You need to use the BEFORE UPDATE event of the form where the value is being entered to check (a DSUM could work) if the resulting value will be over 24 and, if so, issue a

    CANCEL = TRUE

    in that before update event. Then you will likely need to undo the record on the form.

    Me.Undo

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-14-2011, 07:50 AM
  2. Replies: 2
    Last Post: 06-21-2011, 10:08 AM
  3. Deleting values after a field is updated
    By mwhcrew in forum Forms
    Replies: 3
    Last Post: 08-16-2010, 02:52 AM
  4. auto link between front db and back db
    By ahmed in forum Programming
    Replies: 3
    Last Post: 08-09-2010, 07:10 AM
  5. Force form not to save updated fields
    By Evgeny in forum Programming
    Replies: 2
    Last Post: 04-30-2010, 10:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums