Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Undoing a new record? (2003)

    For data entry on one of my databases, I am writing "New Record" On click procedures to fill things in automatically (like generating the new ID numbers that we paste on the equipment).

    I want to provde an "Undo" button in case of mistakes, that will completely eliminate the new record. But, when I use the built in buttons "undo record" or "trash record" . what it seems to do is delete all the record's data, but leaves a blank record.

    I'm sure there's a reason for it, but I'm not really following. I want the record completely removed, and the form returned to the previous record.

    I'm looking at different methods of doing this, but I thought it would be a good idea to ask for advice. I am inclined to just combine the "delete record" code with the "previous record" code. Is it that simple? Or are there other things to worry about?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Undoing a new record? (2003)

    When I want something like this, I usually create an unbound form in which the user can enter the info needed for a new record. If the user clicks OK, code is used to create a new record in the table and write the info into it, then the form is closed. If the user clicks Cancel, the form is just closed, and no record is created at all.

    By the way, the action of the Undo button you created actually removes the new record. If you have an AutoNumber field, you can check this. Say that you start entering data into a new record, and that the AutoNumber field gets value 36. Now click your undo button. The field will revert to (AutoNumber), and if you start entering data again, it will get value 37. So in fact, the form is displaying the next new record. If you don't like this, you can go back to the last existing record (RunCommand acCmdRecordsGoToLast)

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Undoing a new record? (2003)

    Thanks Hans,

    That's probably the best way, but I'm looking to minimize my coding on these forms (so I don't spend all my time debugging), and I'm willing to maek some compromises. It's just the office's hardware and software database. It's not like I'm tracking radioactive samples!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Undoing a new record? (2003)

    If you really want to minimize coding, place a label on the form with the instruction "Press Esc once to undo changes in the current field, or twice to undo all changes in the current record." <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Undoing a new record? (2003)

    I have read all my morning posts and you have a great sense of humour this morning, did you swallow some laughing pills.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Undoing a new record? (2003)

    Must be the start of the weekend (it's still Friday here) <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  7. #7
    5 Star Lounger
    Join Date
    May 2003
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Undoing a new record? (2003)

    You may be joking, but I may just do that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •