Filtering bound field content

  • Thread starter Thread starter andy.crumbacker
  • Start date Start date
A

andy.crumbacker

I am attempting to filter out records; a process that I thought was
VERY simple and straightforward but some detail is elluding me. Here
is what I have: Access2002 SP3, the form UPDATEREQ is using the table
REQ as a data source. This form does not use a query. To eliminate
visual clutter, I wish to filter out when viewing this form, all
instances of the field REQSTATUS that equal "Executed Purchase".
I went into the properties for the form and entered the filter
condition: REQSTATUS <> "Executed Purchase". I cut and pasted this
value from the table directly then enclosed it in quotes as part of the
syntax. Allow filter option is set to YES.
I have tried square brackets and even the detail,
[REQ].[REQSTATUS] <> "Executed Purchase" without success. I attempted
the use of a macro on opening of the form using SETVALUE | Item:
FilterOn | Expression: True but the FilterOn function is not supported
by this Access version. I even tried a visual basic routine for the
form on opening with the syntax: Me.FilterOn = True but received an
error.
Any ideas?
 
I think you are trying to assign this expression to the Filter of the form:
REQSTATUS <> "Executed Purchase"
and to do that you need to place the whole thing in quotes?

The embedded quotes must be doubled, so:
Me.Filter = "REQSTATUS <> """Executed Purchase"""
Me.FilterOn = True

Note that it is the FilterOn line that fails if the expression is invalid.

For an explanation of the expression, see:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html
 
Executed Purchase is the actual value of the field that I want to
filter out. This is a text field so I enclosed it in quotes in what I
thought the syntax should (or should have been) be. I also tried the
formula without any quote marks. I will try doubling up the quote
marks and see what happens. I tried using the FilterOn in Visual Basic
but I received an error; I tried to use the formula builder but it did
not have the FilterOn as a valid function. Perhaps I need to use a
different different library?


Allen said:
I think you are trying to assign this expression to the Filter of the form:
REQSTATUS <> "Executed Purchase"
and to do that you need to place the whole thing in quotes?

The embedded quotes must be doubled, so:
Me.Filter = "REQSTATUS <> """Executed Purchase"""
Me.FilterOn = True

Note that it is the FilterOn line that fails if the expression is invalid.

For an explanation of the expression, see:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

I am attempting to filter out records; a process that I thought was
VERY simple and straightforward but some detail is elluding me. Here
is what I have: Access2002 SP3, the form UPDATEREQ is using the table
REQ as a data source. This form does not use a query. To eliminate
visual clutter, I wish to filter out when viewing this form, all
instances of the field REQSTATUS that equal "Executed Purchase".
I went into the properties for the form and entered the filter
condition: REQSTATUS <> "Executed Purchase". I cut and pasted this
value from the table directly then enclosed it in quotes as part of the
syntax. Allow filter option is set to YES.
I have tried square brackets and even the detail,
[REQ].[REQSTATUS] <> "Executed Purchase" without success. I attempted
the use of a macro on opening of the form using SETVALUE | Item:
FilterOn | Expression: True but the FilterOn function is not supported
by this Access version. I even tried a visual basic routine for the
form on opening with the syntax: Me.FilterOn = True but received an
error.
 
Back
Top