A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Requery ONLY works in timer 0.5 sec later !!!



 
 
Thread Tools Display Modes
  #1  
Old August 8th, 2007, 11:50 AM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 4
Default 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  
Old August 8th, 2007, 03:18 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.