Problem with dynamic filtering

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a master/subform, where a text field on the master form filters the
records viewed via the subform.

Problem:

This works fine (i.e. enter "a" in the text field, and only records with an
"a" in the relevant field are listed for the subform), UNTIL you enter an
invalid filter string, i.e. when the result set is zero records.

(The subform is set to not allow new records to be created). Instead of just
showing an empty form, the application fails, blowing up with the error "You
can't go to the specified record".

At this point I can't readily recover from the error, I can't reset the
filter string, because Access thinks the form is empty, so there's no text
box to set properties on!

Any ideas how I can allow the user to interactively filter a record set, but
trap the "no records found" case BEFORE the subform blows up?

Regards: Colin
 
On your other post, the text box was on the main form. That is where it
needs to be.
 
Rob Oldfield said:
On your other post, the text box was on the main form. That is where it
needs to be.
That may be true. However that doesn't alter the basic problem. When the
filter results in no records being selected, the form/script combo blows up.
I need a way to either trap the problem before it occurs, or recover from it.

With the problem as it is, i can't even store the previous filter string and
reload it in case of an error, because by the time I hit the error the
control is gone and I can't reset it's value.
 
colin_e said:
That may be true. However that doesn't alter the basic problem. When the
filter results in no records being selected, the form/script combo blows up.
I need a way to either trap the problem before it occurs, or recover from it.

With the problem as it is, i can't even store the previous filter string and
reload it in case of an error, because by the time I hit the error the
control is gone and I can't reset it's value.

Dirk has the problem nailed in his response in the other thread. For
reference, starting two threads on the same topic is not a good idea. It
can end up with two separate versions of the same conversation going at the
same time.
 
I Was trying to follow proper etiquette by not asking two quite different
questions (one about bizarre text box selections, one about null recordsets)
in one post, although both issues occur in the same form.

However you are right in saying Dirk's response almost certainly nails the
source of the text selection problem.

I'm still struggling with how to deal with the empty recordset problem,
however at you suggestion I will continue that discussion in the other
thread. Thanks for your help so far.

Regards:Colin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top