Re: access crashing after filter
- From: "riyaz.mansoor@xxxxxxxxx" <riyaz.mansoor@xxxxxxxxx>
- Date: 8 May 2007 20:49:25 -0700
On May 8, 4:36 pm, "BruceM" <bam...@xxxxxxxxxxxxxxxxx> wrote:
For one thing, -1 is True and 0 is False, assuming that B_Completed,
B_Waived, and B_Loss are Yes/No fields.
I have tried with "=0", "<>0", "=TRUE", "=FALSE". All fail
Perhaps you have left out some code, but you don't seem to have declared
tRst.
Declared at the form module level
One line of code is: Set tRst = Me.Recordset
Later, there is: Set Me.Recordset = tRst
In between, nothing affects either Me.Recordset or tRst. You define tRst as
Me.Recordset, then you define Me.Recordset as tRst, but to what end? The
filter and the recordset are two different things. Nothing in your posted
code affects the recordset. If you do have occasion to define Me.Recordset,
you can just use:
With regrads to above and below comments - I think you've
misunderstood. I'm using ADO recordsets generated from MS SQL Server
instance. MS Access cannot filter such Recordsets in the normal way -
ie using the form properties .Filter and .FilterOn
To filter such a Recordset - the recordset itself has to be filtered
and then re- set to the forms recordset. Just applying the filter on
the ADO recordset will not do. Hence:
Set tRst= Me.Recordset
tRst.Filter = "my filter" ' not enough to filter the form
Set Me.Recordset = tRst ' set the filtered recordset for the form
However, IF there is another way to do this, i'm very interested to
know :)
Me.Recordset = strRS (where strRS is a string that you use as a SELECT
statement). What is the intention of the Recordset code?
It may be helpful to set the code to break on all errors. If the code does
not reach the debug line, try adding debug lines elsewhere. For one thing,
make sure that tRst is what you expect (assuming you need it at all).
When I apply a filter I use:
Me.Filter = fil
Me.FilterOn = True
I am not quite familiar with the approach you have taken, but I expect that
you specifically need to apply the filter, not just define it.
On another note, Value is the default property for a combo box, so there is
no need to specify:
If cmbFilter = "None"
There is no harm to specifying Value, but you may as well simplify where you
can.
MS Access is giving me so much trouble!
Riyaz
.
- Follow-Ups:
- Re: access crashing after filter
- From: BruceM
- Re: access crashing after filter
- References:
- access crashing after filter
- From: riyaz.mansoor@xxxxxxxxx
- Re: access crashing after filter
- From: riyaz.mansoor@xxxxxxxxx
- Re: access crashing after filter
- From: BruceM
- access crashing after filter
- Prev by Date: RE: Main form and two Subs claculation
- Next by Date: Re: Tab Control Help Please
- Previous by thread: Re: access crashing after filter
- Next by thread: Re: access crashing after filter
- Index(es):
Relevant Pages
|
Loading