Reputation: 1139
I am trying to put a filter on a form "frmProjectCharter01" where upon opening it (from clicking a button) it will only show records where the field "OnLoad" in its underlying table "tblProjectMasterList" has a "non-null" value.
My current code is
DoCmd.OpenForm "frmProjectCharter01"
Me.Filter = [OnLoad] Is Not Null
Unfortunately, I am getting a "compliation error" message where the private sub opening line is highlighted as well as the "[OnLoad]" field.
Upvotes: 2
Views: 3421
Reputation: 97131
The Filter
property is a string expression, so you can avoid that compile error by adding quotes.
Me.Filter = "[OnLoad] Is Not Null"
However, from the rest of your question, my impression is you should do this with OpenForm
WhereCondition (see the help topic for details) instead of setting a Filter
:
DoCmd.OpenForm "frmProjectCharter01", WhereCondition:="[OnLoad] Is Not Null"
Upvotes: 3