Filtering a Subform

andy1968

Registered User.
Local time
Yesterday, 18:22
Joined
May 9, 2018
Messages
131
Help.


I am certain this is easy, and I just have a syntax error.


I have a subform that I'd like to filter with a command button.


The subform has a calculated field txtOpen with the value:


=IIf(IsNull([DateToContractor]),"Open","Closed")


I am trying the following code, with no luck.


Private Sub cmdOpenOnly_Click()
Me.frmRFIListSubForm.Form.Filter = "txtOpen='Open'"
Me.frmRFIListSubForm.Form.FilterOn = True
End Sub
 
Two questions;
First, does the subform show "Open" and "Closed" properly?
Second, on which form (parent or child) is the button located?
 
Yes, Open and Close show properly.


The button is on the parent form.


Attached is a screen shot.
 

Attachments

  • Capture.JPG
    Capture.JPG
    55.2 KB · Views: 63
I don't get an error, however a window pops up Titled "Enter Parameter Value"


I'll attach a screen shot of it.
 

Attachments

  • Capture.JPG
    Capture.JPG
    74.5 KB · Views: 59
Here is a portion of my database with the problem form.
 

Attachments

You really don't want to filter on the calculated field, you want to filter based on the database field [DateToContractor].

Your filter should be something like
InNull(DateToContractor)

I'd take a look at this thread for a few more ideas.
 
Thanks!


I modified the code as such and got it to work.


Me.frmRFIListSubForm.Form.Filter = "IsNull(DateToContractor) = True"
Me.frmRFIListSubForm.Form.FilterOn = True
 
Last edited:

Users who are viewing this thread

Back
Top Bottom