Hi Guys,
Acc2003.
I have a form that is misbehaving by suddenly refusing to apply a filter I am passing to it.
In a nutshell, I use a public variable to control the form's behaviour called gstrAction.
I have a listbox on the preceding form containing record summaries that I use to open the new form with two buttons:
bttnNew sets gstrAction to "New" and opens the form in acFormAdd mode.
bttnEdit sets gstrAction to "Edit" and passes the filter.
-
"[SampleID] = " & Me.lstSample
-
However, the form continues to open in New mode.
If I MsgBox on form open the values gstrAction, Me.Filter and Me.FilterOn they are all as one would expect.
Strangely, If I go into design mode and back the filter is applied!
I have compiled my code, compact and repaired and created a new .mdb and imported all of the objects. Still the same behaviour.
I have circumvented this behaviour temporarily by not passing the filter in but rather have the form check if it is in "Edit" mode on open. If it is it grabs the Selected Index off of the list form and applies the filter itself.
However, this is now playing havoc with some of the form's other functions, for example there is code that dictates what the buttons' captions display and what they do based on populated data and mode.
Any ideas how I can get the filter working?
Gaz.