Why is a filter on a form is being replaced by a search macro? (1 Viewer)

jonobugs

Registered User
Joined
Apr 15, 2013
Messages
70
I have a student database (Access 2007) and on the student information form I have it filtered so that only the active students are shown.

The filter is on the "Data" tab on the property sheet.

Although I could filter this out on a query, I do it this way because I sometimes want to have access to all the records.

On a separate form, I have a search function. I'm just using macros and it works just fine. I first have the macro open the Student form, then use the "Where Condition" and I typed in this: [FN] Like "*" & [Forms]![frmFind]![txtSearchStudents] & "*"

Okay, so this works, but what happens is that it changes the "Filter" on the Student form, so that the next time I open up the student form I get an error message because my filter is replaced with this: [FN] Like "*" & [Forms]![frmFind]![txtSearchStudents] & "*"

Does anyone know why it's being replaced?
 
Last edited:

MarkK

Super Moderator
Joined
Mar 17, 2004
Messages
7,761
That is the "by-design" behaviour. When you provide a filter in the DoCmd.OpenForm command, that becomes the form's filter. The old filter is overwritten by the new one.
hth
Mark
 

jonobugs

Registered User
Joined
Apr 15, 2013
Messages
70
Okay, I see. Well, I guess I'll just have to change my query that I use to load the form to change it back to the old filter otherwise it shows an error.

Thanks!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom