How to Requery Sub form from another sub form

A

AJ

I have a main form with 2 sub forms. The first sub form has a list of
businessnames and when I click on one of the names I want the second
sub form to filter to that name.

First it copies the name to an unbound text box on the main form. It
is called NameChosen.
The second sub form is based on a query that filters off NameChosen.

The following code works (sometimes) and is placed in the on click
event of the name in the first subform:

Forms!MismatchMainfrm!NameChosen = BusinessName
Forms!MisMatchMainfrm!MisMatch020subMatchIt.Requery

This works but sometimes does not. The database likes it well enough,
but when I close down and come back in, sometimes things go wrong.
I've been here before and when I wrote the procedure I had the faint
idea that I should be doing this in another way. What is wrong with
this code and how should I change it?

When this code fails, all I have to do is take the code off, save it,
close down, come back in, reinstate the code, and bingo, it works.

Matt
 

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

Top