View Full Version : Form Events - Error OnCurrent


Elana
10-10-2001, 11:55 AM
I have a form (frmAPRP) that can only be opened if another form (frmChanges) is open. My "on Load" event for frmAPRP states:

"If IsNull(Me.OpenArgs) Then
MsgBox "This form must be opened from within another form", vbCritical, "Cannot Open Form"
DoCmd.Close acForm, Me.Name
End If"

All works okay to this point; however, my "onCurrent" event for frmAPRP still appears to be firing, even though I have closed the form in the OnLoad event. This generates an error because I pass values to two fields in the OnCurrent event, assuming the frmChanges is open.

Am I missing something? Why would the OnCurrent still fire after I have closed the form in the previous procedure?

Thanks for any help you can give me that will steer me in the right direction.



[This message has been edited by Elana (edited 10-10-2001).]

SteveA
10-12-2001, 01:47 AM
I'm not sure about the sequence of events being triggered in this scenario, but maybe you can set a public variable (ie blnLoaded) to false in the OnLoad event and then check this value in the OnCurrent event.

HTH
SteveA