on current

  • Thread starter Thread starter mcnewsxp
  • Start date Start date
M

mcnewsxp

how can i detect via code when a form's on current event has finished
firing?

tia
mcnewsxp
 
how can i detect via code when a form's on current event has finished
firing?

tia
mcnewsxp

Add a message box to the very end of the code in the event.

You regular Current event code here.
MsgBox "Yoo hoo! I'm done."
 
fredg said:
Add a message box to the very end of the code in the event.

You regular Current event code here.
MsgBox "Yoo hoo! I'm done."
--

not exactly what i need.

for some reason the on current event on one of my subforms is firing 3 times
every time.

this form has several tabs that get hidden or displayed based on a value on
the main form.
the flashing that occurs is very annoying to have to watch it 3 times.
 
As I understand, the subform's Current event runs before the main form's
Current event. If the main form's Current event (or some other event)
manipulates the subform recordset, the subform's Current event will run
again. Without seeing your code it is not really possible to suggest why
this is happening, but if you set a break point in the subform's Current
event code you should be able to track what is going on. It may be possible
to set a Boolean in the main form's Current event, and test for that value
in the subform's Current event.

Option Compare Database
Option Explicit

Public blnWait as Boolean


Subform's Current event:
Private Sub Form_Current()

If blnWait = True Then
Exit Sub
Else
' Current event code
blnWait = True
End If

End Sub


Main form's Current event:
Private Sub Form_Current()

' Code for Current event
blnWait = False

End Sub


The idea is that the subform's Current event doesn't run until the main
form's Current event sets blnWait to False. After the subform's Current
event runs, blnWait is reset to True.

This is just a general idea. It could be that after you are in a new main
form record you need the subform's Current event to run each time you
navigate to another subform record, or something like that, in which case
you would need to modify your approach.
 
Back
Top