Problem with filter

L

Les Isaacs

Hello All
I have a form called 'frm prospects' that opens in continuous form view. One
of the fields is called 'prospect_notes'. In the form header I have a
textbox called 'lookfor' and a button with the following OnClick event:

Private Sub Command26_Click()
Me.Filter = "[prospect_notes].Value Like '*' & [Forms]![frm
prospects]![lookfor] & '*'"
Me.FilterOn = True
End Sub

... but when I click the button a popup dialogue asks me for the paramater
value of [prospect_notes].Value. I have tried variations on the delimiters,
and leaving out the '.Value' parts, but cannot get this work. Hope someone
can help.

Many thanks
:Leslie Isaacs
 
D

Dirk Goldgar

"Les Isaacs" wrote in message
Hello All
I have a form called 'frm prospects' that opens in continuous form view.
One of the fields is called 'prospect_notes'. In the form header I have a
textbox called 'lookfor' and a button with the following OnClick event:

Private Sub Command26_Click()
Me.Filter = "[prospect_notes].Value Like '*' & [Forms]![frm
prospects]![lookfor] & '*'"
Me.FilterOn = True
End Sub

.. but when I click the button a popup dialogue asks me for the paramater
value of [prospect_notes].Value. I have tried variations on the
delimiters, and leaving out the '.Value' parts, but cannot get this work.
Hope someone can help.


You definitely don't want the ".Value" part,a nd you shouldn't need the
brackets around the field name in this case. If you've tried this:

Me.Filter = "prospect_notes Like '*' & [Forms]![frm prospects]![lookfor]
& '*'"

and it didn't work, then double-check to make sure that "prospect_notes" is
actually the name of the field in the form's recordsource table or query,
and not just the name of the text box on the form.
 
L

Les Isaacs

Dirk
Your suggestion works perfectly - many, many thanks!
Les


Dirk Goldgar said:
"Les Isaacs" wrote in message
Hello All
I have a form called 'frm prospects' that opens in continuous form view.
One of the fields is called 'prospect_notes'. In the form header I have a
textbox called 'lookfor' and a button with the following OnClick event:

Private Sub Command26_Click()
Me.Filter = "[prospect_notes].Value Like '*' & [Forms]![frm
prospects]![lookfor] & '*'"
Me.FilterOn = True
End Sub

.. but when I click the button a popup dialogue asks me for the paramater
value of [prospect_notes].Value. I have tried variations on the
delimiters, and leaving out the '.Value' parts, but cannot get this work.
Hope someone can help.


You definitely don't want the ".Value" part,a nd you shouldn't need the
brackets around the field name in this case. If you've tried this:

Me.Filter = "prospect_notes Like '*' & [Forms]![frm
prospects]![lookfor] & '*'"

and it didn't work, then double-check to make sure that "prospect_notes"
is actually the name of the field in the form's recordsource table or
query, and not just the name of the text box on the form.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top