Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

very first form action is form_current()

Status
Not open for further replies.

charlie12345

Technical User
Mar 4, 2001
28
US
The very first thing my form is doing is going to Form_Current(), then Form_Load(), and then again to Form_Current() before displaying the record.

How/why is it executing Form_Current() before Form_Load() ?
My other forms haven't done this, so I'm at a loss.

Thanks,
Charlie
 
Charlie,

How or what tiggers the opening of the form in question?

Is there anything in the FormCurrent event for the form in question that might be tiggering something that you are not aware of?


HTH,

Steve
 
Just to let you know you're not alone -- I encountered the very same problem just this afternoon. Before my form even loads and is visible, its OnCurrent event fires a messagbox. Weird.
 
Charlie and Vie,


I added message boxes to a form's load and current event.

I saw the result I expected. The Load event occurred followed by the Current.

This leads me to believe there may be a control that is doing a refresh or requery action as the form loads.

HTH,

Steve
 
I made a new form and copied all the controls and procedures to it. Form_Load() fired first then Form_Current().

Form_Current had only the following:
MsgBox("Form_Current")

I then added the following code:

MsgBox("Form_Current")
intI = 0
Do While intI <= intAttributeCount
If Me!Attribute1 = arrayAttributes(intI) Then
MsgBox(&quot;Found It&quot;)
intI = intI+1
Exit Do
End If
Loop
End Sub

intAttributeCount and arrayAttributes were set in Form_Load() but declared in General Declarations as:
Dim arrayAttributes() As String
Public intAttributeCount As Integer

It then went back to firing in the order Form_Current(), Form_Load(), Form_Current(), giving me an error becuase arrayAttributes had a subscript of of range (because it was filled in Form_Load).

Removing the newly added code (leaving only MsgBox(&quot;Form_Current&quot;) didn't change the firing order; it remains Form_Current(), Form_Load(), Form_Current().

I now have a boolean in Form_Current to check if this is the very first firing of Form_Current, to skip over doing the code; its not a very elegant solution, but it is working.

Charlie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top