If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Requery ONLY works in timer 0.5 sec later !!!
Hello everyone and thank you for your time, I have a simple form with a subform with a CANCEL button on it. The problem is that if I don't use the DoCmd.Requery command, the form advances to the next record even though the previous one was still empty. If I put the DoCmd.Requery on the bottom or the top of the Cancel code it dose not work, the ONLY way I have my form working properly at the moment is like so.... Private Sub Cancel_Click() Me.TimerInterval = 500 DoCmd.SetWarnings False DoCmd.RunCommand acCmdDeleteRecord DoCmd.SetWarnings True End Sub Private Sub Form_Timer() DoCmd.Requery End Sub This has solved my problem and everything is ok, it's just that I'm not feeling comfortable using Timer event and would appreciate if someone could tell me what my problem is and how to put that requery command on the cancel button. Thanking you all in advance. |
#2
|
|||
|
|||
Requery ONLY works in timer 0.5 sec later !!!
It isn't that clear what you are trying to accomplish.
If you are trying to cancel a new record before it is appended to the form's recordset or cancel changes made to an existing record, what you want is: Me.Undo This causes the current record to revert to its state when it became the current record. For existing records, all the changes will be replaced by their previous values. For new records, All data entered will be removed and the form will no longer be Dirty. -- Dave Hargis, Microsoft Access MVP " wrote: Hello everyone and thank you for your time, I have a simple form with a subform with a CANCEL button on it. The problem is that if I don't use the DoCmd.Requery command, the form advances to the next record even though the previous one was still empty. If I put the DoCmd.Requery on the bottom or the top of the Cancel code it dose not work, the ONLY way I have my form working properly at the moment is like so.... Private Sub Cancel_Click() Me.TimerInterval = 500 DoCmd.SetWarnings False DoCmd.RunCommand acCmdDeleteRecord DoCmd.SetWarnings True End Sub Private Sub Form_Timer() DoCmd.Requery End Sub This has solved my problem and everything is ok, it's just that I'm not feeling comfortable using Timer event and would appreciate if someone could tell me what my problem is and how to put that requery command on the cancel button. Thanking you all in advance. |
Thread Tools | |
Display Modes | |
|
|