Results 1 to 6 of 6
  1. #1
    lavi111 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    4

    form exit problem

    i have a form that has a button that add a new record. int the button im checking if the amount i order is ssmaller than my amount.


    if i press the button it works fine but if i have data on the text boxes and i close the form with the close button the data on those text box is save in a new record and it is not checked.
    why it add's a record when im exiting the form?
    how to solve it?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    A form bound to a table will automatically try to save. Do your validation in the before update event:

    http://www.baldyweb.com/BeforeUpdate.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by pbaldy View Post
    ...Do your validation in the before update event...
    Note that Paul means the Form_BeforeUpdate event, not the BeforeUpdate event for the Amount Control.

    Linq ;0)>

  4. #4
    lavi111 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    4
    thank but i managed to solve it with me.Undo first

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by Missinglinq View Post
    Note that Paul means the Form_BeforeUpdate event, not the BeforeUpdate event for the Amount Control.

    Linq ;0)>
    That is mentioned in the link.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You know that, Paul, and I know that, but OPs tend to not carefully read all the information when we give them a nice link like yours!

    I'm trying to figure out how (and where) the problem, as stated, was solved with 'me.Undo first!' Bet it wasn't in the Form_BeforeUpdate event!

    Linq ;0)>

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

Similar Threads

  1. Exit forms without saving
    By sk88 in forum Access
    Replies: 19
    Last Post: 12-19-2013, 06:04 PM
  2. Exit without saving Subform
    By sk88 in forum Access
    Replies: 5
    Last Post: 05-03-2012, 11:55 AM
  3. exit
    By slimjen in forum Forms
    Replies: 4
    Last Post: 10-09-2011, 09:30 AM
  4. exit form using BeforeUpdate 'or' cmdButton
    By ConfusedMike in forum Forms
    Replies: 9
    Last Post: 09-21-2011, 10:05 PM
  5. Replies: 9
    Last Post: 08-06-2011, 02:10 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