I have a command button that runs the following code
Code:
If Me.FilterOn = False Then
Me.FilterOn = True
Me.Filter = "[Select] = -1"
Me.Refresh
Me.Requery
Me.cmdFilter.Caption = "Show All"
Else
Me.FilterOn = False
Me.Filter = ""
Me.cmdFilter.Caption = "Show Selected"
Me.Refresh
End If
This works most of the time, except when the form first opens. I've watched the code step through the True portion of the code, but my form does not respond except for the caption change, which is then out of sync with the screen since all records are being display. I've check and the FilterOn property is still false. Clicking the button again executes the same True portion of code since FilterOn is still false. This time the code executes normally, the filter applies and everything is back in sync.
Why doesn't the code execute correctly the first time?