Filter loses results (1 Viewer)

WJB

Registered User.
Local time
Today, 10:17
Joined
Jan 24, 2017
Messages
10
Ok, so I'm REALLY confused! And have no idea how to describe my issue so am hopefully (!) attaching a copy of my db.

Basically my problem is with "Product creation Form Part 4"
It is designed to show various details of products from various suppliers. And works like that :)

In the subform, where it shows the info, I can swap the supplier (via the combobox) and the supplier's codes for the products swaps (suppb has lots, suppa has none)
I can limit what is shown in the subform by using the comboboxes in the main form. Eg, under 'lifestage' if I select "puppy", only the products suitable for a puppy are shown.
While this happens, I can still swap the codes between suppa and suppb.

What is weird though, when I cancel the selection in the main form (either by selecting the combobox choice again and hitting delete, or using my "clear" button), even though I believe everything returns to how it was before, the suppa and suppb option no longer does anything. It always shows suppb's codes.

I've spent ages going around and around and as I say, I believe I've compared all settings etc and can't for the life of me understand why the combobox suddenly stops working.

Would LOVE your help,

thanks loads xx
 

Attachments

  • wjb.zip
    745.6 KB · Views: 85

sneuberg

AWF VIP
Local time
Yesterday, 19:17
Joined
Oct 17, 2014
Messages
3,506
This reason why it still shows suppb when you click the Clear All selection button is because with no filter you can see in the record source query (Product part4 Query) that whatever [TempVars]![Supplier_ID] is set to controls what is displayed in the subform. If you put a debug.print [TempVars]![Supplier_ID] in Clear All selection button's code you will see that's it's set to 2.
 

WJB

Registered User.
Local time
Today, 10:17
Joined
Jan 24, 2017
Messages
10
It's set to 2 yes, but then when you change the drop down in the sub form to suppa, the tempvars changes to 2 and the form is requeried, but it doesn't change the data in the form. At the start, when you load it up before you use any of the drop downs in the main form, it also relies on the tempvars and it works
 

sneuberg

AWF VIP
Local time
Yesterday, 19:17
Joined
Oct 17, 2014
Messages
3,506
It's set to 2 yes, but then when you change the drop down in the sub form to suppa, the tempvars changes to 2

Not that it matters but subba supplier_id is 1 not 2

One of the problems seems to be that the filter is set to "not isnull(code)" when a selection is made in the supplier combo. Data is display for suppb as these codes are not null, e.g., BH108, BH311. These are null for the suppa records.
 

WJB

Registered User.
Local time
Today, 10:17
Joined
Jan 24, 2017
Messages
10
ah yes, that was a typo in my reply!
there are 2 ways to select the supplier - the main form which uses the null bit, and the subform which doesn't.
When there's nothing in the main form, the subform should revert back to working like it does before you try selecting anything in the main form.

It's odd. It seems that once you have used the .filter property, the data remain like that even when you remove it and the TempVars should take over again.

I have just realised that I can get around it by putting some rubbish in there instead of it being blank when nothing is selected. ie. if I make it Brand_ID > 0 (which is always is) when nothing is selected in the main form, the subform controls work again. It's a fix rather than solving the problem so not happy, but can at least carry on.

If anyone can solve the problem though I'd be very interested...
 

Users who are viewing this thread

Top Bottom