Results 1 to 5 of 5
  1. #1
    Joakim N is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    Oct 2016
    Posts
    79

    Identify new record and discard...


    Hi,

    I want to add a cmdButton "Discard" that does following:
    - If it is a new record, don't store any values.
    - If is an old record, return to old data before any cahnges.

    Seems quite simple but I can't find out how to write the code.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You'll have to explain your definition of old vs new. I'd wager that to most of us, a new record is one that is being created but has not been written to the table. I cannot see how your request could fit that definition, since it would not be possible to create a new record with absolutely no values in any fields.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  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,016
    Where cmdDiscard is the name of the Command Button:

    Code:
    Private Sub cmdDiscard_Click()
     Me.Undo
    End Sub

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Joakim N is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    Oct 2016
    Posts
    79
    Worked great. Thanks!

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Glad we could help!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. How to Identify Running Tasks Using VBA
    By EddieN1 in forum Programming
    Replies: 0
    Last Post: 06-15-2016, 04:33 PM
  2. Replies: 1
    Last Post: 10-29-2014, 03:44 AM
  3. Replies: 1
    Last Post: 02-12-2013, 03:48 AM
  4. Identify which criteria was used
    By ridersjs in forum Queries
    Replies: 2
    Last Post: 11-29-2011, 10:44 AM
  5. Replies: 13
    Last Post: 11-08-2011, 11:57 AM

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