Hi -
I have a command button that opens a form. That form has a subform that I'm trying to filter based on the record that was open on the form where the button exists.
When I run this code, I get the following error:
Run-time error 3075: Syntax error (missing operator) in query expressions 'DetailItem = Sales and Marketing Fund'.
So it seems to be picking up the value that I'm trying to filter on (Sales and Marketing Fund), but can't apply that filter to the subform control (DetailItem). The subform (sbfrmSearchRecords) is a datasheet within the main form frmSearchRecords. I can't figure out what's wrong with the syntax.
Thanks in advance for your help!
I have a command button that opens a form. That form has a subform that I'm trying to filter based on the record that was open on the form where the button exists.
Code:
DoCmd.OpenForm "frmSearchRecords"
Forms!frmSearchRecords![sbfrmSearchRecords].Form.Filter = "DetailItem = " & DetailItem
Forms!frmSearchRecords![sbfrmSearchRecords].Form.FilterOn = True
When I run this code, I get the following error:
Run-time error 3075: Syntax error (missing operator) in query expressions 'DetailItem = Sales and Marketing Fund'.
So it seems to be picking up the value that I'm trying to filter on (Sales and Marketing Fund), but can't apply that filter to the subform control (DetailItem). The subform (sbfrmSearchRecords) is a datasheet within the main form frmSearchRecords. I can't figure out what's wrong with the syntax.
Thanks in advance for your help!