Filter Subform from the Main form

Poco_90

Registered User.
Local time
Today, 09:17
Joined
Jul 26, 2013
Messages
87
Hi,
I know this should be easy, but I am going wrong somewhere. I have a form frmStockTake and a subform sfrmStockTake. I have several combo boxes on the main form that the user selects to filter the subform via a query. This is working as I want.

My problem is I would like to ad preferably a toggle button to the main form. to show/hide stock with a qty = 0.

1. I tried a and additional combo box on the main form, but it returned any stock with a 0 in the quantity. (Row source = "0"). Not sure how to return just 0. I'd be happy with using this at this stage.

2. Any attempt on buttons on the main form either don't work or I get errors.

3. My subform is viewed as a datasheet from the main. If I change it to form view I have had some success showing qty = 0

Code:
    If me.filter = "[Qty] = 0" Then
                 me.filteron = True
              else
                 me.filteron =False
              End if
But this is no good with wanting ta datasheet view.

Any help would be appreciated. Thanks in advance,
Poco
 
from the main form you refer to the filter on the subform as

me.subformcontrolname.form.filter="[Qty]=0"
me.subformcontrolname.form.filteron=true
 
Hi CJ,
Thank you for responding. This is something I had previously tried.

On the main form frmStockTake I have a toggle button with the following

me.qty.form.filter ="[Qty]=0"
me.qty.form.filteron = true

I get a compile error (Method or Data member not found), I tried

me.qty.sfrmStockTake.filter

and get the same error. :banghead:

any other ideas?
 
is the name of your subform control called 'qty'?
 
It is unless I am mistaken. I have attached a screen shot.
Poco
 

Attachments

  • db.JPG
    db.JPG
    81.3 KB · Views: 138
put the form in design view, click on the subform and display the properties - then screenshot that
 
Thanks CJ. See picture 1
Poco
 

Attachments

  • 1.jpg
    1.jpg
    92.6 KB · Views: 106
  • 2.jpg
    2.jpg
    94.6 KB · Views: 130
you need to click on the subform control (not the form within the control),- I want to confirm the name of the subform control. You are showing the properties for the main form.
 
CJ, is this what you are looking for?
 

Attachments

  • Capture.jpg
    Capture.jpg
    94.3 KB · Views: 128
yes

your code should be

me.sfrmStockTake.form.filter="[Qty]=0"
me.sfrmStockTake.form.filteron=true

you were trying

On the main form frmStockTake I have a toggle button with the following

me.qty.form.filter ="[Qty]=0"
me.qty.form.filteron = true

I get a compile error (Method or Data member not found), I tried

me.qty.sfrmStockTake.filter

and get the same error.
banginghead.gif
 

Users who are viewing this thread

Back
Top Bottom