Me.Undo doesn't work, records are added each time i enter the form and exit

Joined
Sep 30, 2015
Messages
1
Reaction score
0
Hello everyone.

I have a problem that comes and goes...it's driving me mad.

Example :

-" Main Menu" Form +
Button "Test" (Open Form "Test")

- Form "Test" +
Button "Save Record and Go to Main Menu"

Code:
Private Sub btnGuardarRegisto_Click()

  RunCommand acCmdSaveRecord
  DoCmd.OpenForm "SubMenu 3"
  DoCmd.Close acForm, "3_1 - Fase da Doença"

End Sub

Button "Don´t Save and Go to Main Menu" (does a "Me.Undo")

Code:
Private Sub btnMenuTópicos_Click()

  Me.Undo
  DoCmd.OpenForm "SubMenu 3"
  DoCmd.Close acForm, "3_1 - Fase da Doença"

End Sub

Each time i enter that form, by exit and save, it adds a record, everything ok.
But when i don´t save and exit, it keeps addind a blank record, and does it everytime (the ID keeps getting bigger more and more).

ID - Information
...
11 - (empty)
12 - (empty)
13 - (empty)
...
47 - (empty)

Why doesn´t the Me.Undo command work when i exit?
It should clear all info and delete the record that is created when i entered the form, right ?

I tried it before and it was working well, but now it has this behaviour.

Can someone please help ? :(

Thanks
 
Back
Top