After DELETE, how to refresh (or requery)

Oh, and the Access help file is sometimes not as accurate as it should be.
 
I figured a way to bypass this issue by using the form timer.

1- Set the timer to a very high number on the Current or Load event.

Private Sub Form_Current()
Me.TimerInterval = 90000000
End Sub

2- Requery on the Timer event and reset timer interval to the high number.

Private Sub Form_Timer()
Me.Requery
Me.TimerInterval = 90000000 'Reset timer interval
End Sub

3- On your Delete event set the timer interval to one millisecond so that the form is re-queried right away.

Private Sub Form_Delete(Cancel As Integer)

Me.TimerInterval = 1

End Sub

Not too elegant but it works! You are welcome.
 
Instead of using a very high number for the timer event, just set it to 0 when you are not using it:
Me.TimerInterval = 0

This disables the timer event from occuring until you re-enable it by your existing code
Me.TimerInterval = 1
 
Actually a work-around was posted. Changing the recordsource forces a requery, at which point a refresh is just redundant.
 
Actually a work-around was posted. Changing the recordsource forces a requery, at which point a refresh is just redundant.

Also redundant to have to reset the RecordSource to what it already is set to. Very odd code behavior!!!
 

Users who are viewing this thread

Back
Top Bottom