L
Laurel
Ken, here's a response to your helpful answer back in the thread called "How
can I refresh this filter attribute?" I posted it some time after the
original interchange, so it probably didn't pop up on your radar. TIA,
Laurel
OK, now I think I have a variation on this problem. I believe your
suggestion is working when the "stuck" criterion is found, literally, in the
filter property of the form itself. But there is another situation where
the "stuck" criterion is found as part of the Query that is behind a form.
That is, I have to open up the recordsource and then I see the "stuck"
criterion. In this situation, setting the Me.Filter doesn't get rid of the
critierion attached to the query. When I query is used inside of a script,
I "refresh" it with the following routine. I have too forms of the query,
one that is never used except to refresh the one that is used. But I don't
know how to refresh the query behind a form. I has already been opened by
the time I'm able to execute a script. (I think.) Surely I don't have to
have a different query for every form - each one varying only in name, so
they can't get "corrupted?" Or I don't have to have a "hidden" form that
does nothing but refresh the query behind the form about to be opened?
(E.g., I have a QueryScoresBase and a QueryScores, and I execute the
following Set qdfBaseQuery = CurrentDb.QueryDefs(as_BaseQuery)
Set qdfRefreshedQuery = CurrentDb.QueryDefs(as_RefreshedQuery)
li_order = InStr(1, qdfBaseQuery.SQL, "Order By")
ls_select = Left(qdfBaseQuery.SQL, li_order - 1)
ls_sort = Right(qdfBaseQuery.SQL, Len(qdfBaseQuery.SQL) - (li_order -
2))
ls_sql = ls_select & ls_where & ls_sort
qdfRefreshedQuery.SQL = ls_sql
qdfBaseQuery.Close
qdfRefreshedQuery.Close
can I refresh this filter attribute?" I posted it some time after the
original interchange, so it probably didn't pop up on your radar. TIA,
Laurel
OK, now I think I have a variation on this problem. I believe your
suggestion is working when the "stuck" criterion is found, literally, in the
filter property of the form itself. But there is another situation where
the "stuck" criterion is found as part of the Query that is behind a form.
That is, I have to open up the recordsource and then I see the "stuck"
criterion. In this situation, setting the Me.Filter doesn't get rid of the
critierion attached to the query. When I query is used inside of a script,
I "refresh" it with the following routine. I have too forms of the query,
one that is never used except to refresh the one that is used. But I don't
know how to refresh the query behind a form. I has already been opened by
the time I'm able to execute a script. (I think.) Surely I don't have to
have a different query for every form - each one varying only in name, so
they can't get "corrupted?" Or I don't have to have a "hidden" form that
does nothing but refresh the query behind the form about to be opened?
(E.g., I have a QueryScoresBase and a QueryScores, and I execute the
following Set qdfBaseQuery = CurrentDb.QueryDefs(as_BaseQuery)
Set qdfRefreshedQuery = CurrentDb.QueryDefs(as_RefreshedQuery)
li_order = InStr(1, qdfBaseQuery.SQL, "Order By")
ls_select = Left(qdfBaseQuery.SQL, li_order - 1)
ls_sort = Right(qdfBaseQuery.SQL, Len(qdfBaseQuery.SQL) - (li_order -
2))
ls_sql = ls_select & ls_where & ls_sort
qdfRefreshedQuery.SQL = ls_sql
qdfBaseQuery.Close
qdfRefreshedQuery.Close