Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering Subform on Yes/No field using "With" Statement Hanging Up 1

Status
Not open for further replies.

Johnnycat1

Programmer
May 4, 2005
71
US
I have a combo box on a form that is based on "Yes/No" data type. The combo box is used to filter data in a subform that is also "yes/no" data. This code works just fine when it is based on "Text" datatypes but is erroring out when I try to apply it to the "Yes/No" data type.

This is the code:

Private Sub Combo28_AfterUpdate()

With Forms![Job # Project PSR Form]![Job # Project PSR SubForm].Form
.Filter = " [PSR] ='" & Forms![Job # Project PSR Form]![Combo28] & "'"
.FilterOn = True
End With

End Sub

Any suggestions???

As always, your help is much appreciated!
 
Do you mean the combo returns Yes or No? A boolean field does not need quotes as the datastored is either 0 or 1

This may suit:
[tt].Filter = " [PSR] =" & (Forms![Job # Project PSR Form]![Combo28]="Yes")[/tt]

Or just possibly:
[tt].Filter = " [PSR] =" & Forms![Job # Project PSR Form]![Combo28][/tt]
 
As always, Remou hits it on the head.

Thank you. I could have wasted all kinds of time if it weren't for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top