docmd applyfilter with wildcard

G

Guest

I have an unbound textbox on a form that I want to type some text into and
then filter the data showing only the records that contain the word. The
field I'm trying to filter is a text field called loss description. I'm
having triouble filtering the data using wildcards. My first step was to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and nothing else. I
need to include all reecords that include the word lighning, so I next tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to do this?
After I get the syntax correect, I want to replace the word lightning with a
refernce to a user text box on the form called Txtkeyword.
 
F

fredg

I have an unbound textbox on a form that I want to type some text into and
then filter the data showing only the records that contain the word. The
field I'm trying to filter is a text field called loss description. I'm
having triouble filtering the data using wildcards. My first step was to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and nothing else. I
need to include all reecords that include the word lighning, so I next tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to do this?
After I get the syntax correect, I want to replace the word lightning with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" & Me![ControlName] &
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
G

Guest

i don't know if this extension my thread represents is kool or not, but i
want to enable my user to open a form subject to the condition the value of
the "Patient Number" on it is equal to a value selected by the user on the
'Switchboard' form called 'Command and Control Center' via an unbound combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



fredg said:
I have an unbound textbox on a form that I want to type some text into and
then filter the data showing only the records that contain the word. The
field I'm trying to filter is a text field called loss description. I'm
having triouble filtering the data using wildcards. My first step was to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and nothing else. I
need to include all reecords that include the word lighning, so I next tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to do this?
After I get the syntax correect, I want to replace the word lightning with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" & Me![ControlName] &
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
D

Douglas J. Steele

Try putting the control name outside of the quotes, to ensure you get its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
i don't know if this extension my thread represents is kool or not, but i
want to enable my user to open a form subject to the condition the value
of
the "Patient Number" on it is equal to a value selected by the user on the
'Switchboard' form called 'Command and Control Center' via an unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



fredg said:
I have an unbound textbox on a form that I want to type some text into
and
then filter the data showing only the records that contain the word.
The
field I'm trying to filter is a text field called loss description. I'm
having triouble filtering the data using wildcards. My first step was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and nothing
else. I
need to include all reecords that include the word lighning, so I next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to do this?
After I get the syntax correect, I want to replace the word lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" & Me![ControlName] &
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
G

Guest

douglas,

here's my text

DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

note the ',' i put after the 'ApplyFilter' per the a2k help docu'n.....yet,
still it doesn't open to the chosen Patient Number from the switchboard?

-te


Douglas J. Steele said:
Try putting the control name outside of the quotes, to ensure you get its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
i don't know if this extension my thread represents is kool or not, but i
want to enable my user to open a form subject to the condition the value
of
the "Patient Number" on it is equal to a value selected by the user on the
'Switchboard' form called 'Command and Control Center' via an unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



fredg said:
On Thu, 6 Jan 2005 07:07:02 -0800, Larry R wrote:

I have an unbound textbox on a form that I want to type some text into
and
then filter the data showing only the records that contain the word.
The
field I'm trying to filter is a text field called loss description. I'm
having triouble filtering the data using wildcards. My first step was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and nothing
else. I
need to include all reecords that include the word lighning, so I next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to do this?
After I get the syntax correect, I want to replace the word lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" & Me![ControlName] &
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
G

Guest

just a quick addendum.....

i have tried this both in an 'OnOpen' and 'OnLoad' event property -- thie
latter which i have to think is the more appropriate decision; in that
instance, i get a Parameter query asking for "Me.Patient Number". does it
have anything at all to do with the control's being a combobox in both
instances?

-ted


Ted said:
douglas,

here's my text

DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

note the ',' i put after the 'ApplyFilter' per the a2k help docu'n.....yet,
still it doesn't open to the chosen Patient Number from the switchboard?

-te


Douglas J. Steele said:
Try putting the control name outside of the quotes, to ensure you get its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
i don't know if this extension my thread represents is kool or not, but i
want to enable my user to open a form subject to the condition the value
of
the "Patient Number" on it is equal to a value selected by the user on the
'Switchboard' form called 'Command and Control Center' via an unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



:

On Thu, 6 Jan 2005 07:07:02 -0800, Larry R wrote:

I have an unbound textbox on a form that I want to type some text into
and
then filter the data showing only the records that contain the word.
The
field I'm trying to filter is a text field called loss description. I'm
having triouble filtering the data using wildcards. My first step was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and nothing
else. I
need to include all reecords that include the word lighning, so I next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to do this?
After I get the syntax correect, I want to replace the word lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" & Me![ControlName] &
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
D

Douglas J. Steele

How are you opening the form? If you're using DoCmd.OpenForm, you can
specify the filter then.

Otherwise, rather than the DoCmd.ApplyFilter, you could try:

Me.Filter = "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
Me.FilterOn = True

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
just a quick addendum.....

i have tried this both in an 'OnOpen' and 'OnLoad' event property -- thie
latter which i have to think is the more appropriate decision; in that
instance, i get a Parameter query asking for "Me.Patient Number". does it
have anything at all to do with the control's being a combobox in both
instances?

-ted


Ted said:
douglas,

here's my text

DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

note the ',' i put after the 'ApplyFilter' per the a2k help
docu'n.....yet,
still it doesn't open to the chosen Patient Number from the switchboard?

-te


Douglas J. Steele said:
Try putting the control name outside of the quotes, to ensure you get
its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



i don't know if this extension my thread represents is kool or not,
but i
want to enable my user to open a form subject to the condition the
value
of
the "Patient Number" on it is equal to a value selected by the user
on the
'Switchboard' form called 'Command and Control Center' via an unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



:

On Thu, 6 Jan 2005 07:07:02 -0800, Larry R wrote:

I have an unbound textbox on a form that I want to type some text
into
and
then filter the data showing only the records that contain the
word.
The
field I'm trying to filter is a text field called loss
description. I'm
having triouble filtering the data using wildcards. My first step
was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and
nothing
else. I
need to include all reecords that include the word lighning, so I
next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to do
this?
After I get the syntax correect, I want to replace the word
lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" & Me![ControlName]
&
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
G

Guest

douglas,

i'm using the switchboard wizard's option to open it using 'Open Form' from
the dropdown menu's list of choices.

-ted


Douglas J. Steele said:
How are you opening the form? If you're using DoCmd.OpenForm, you can
specify the filter then.

Otherwise, rather than the DoCmd.ApplyFilter, you could try:

Me.Filter = "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
Me.FilterOn = True

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
just a quick addendum.....

i have tried this both in an 'OnOpen' and 'OnLoad' event property -- thie
latter which i have to think is the more appropriate decision; in that
instance, i get a Parameter query asking for "Me.Patient Number". does it
have anything at all to do with the control's being a combobox in both
instances?

-ted


Ted said:
douglas,

here's my text

DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

note the ',' i put after the 'ApplyFilter' per the a2k help
docu'n.....yet,
still it doesn't open to the chosen Patient Number from the switchboard?

-te


:

Try putting the control name outside of the quotes, to ensure you get
its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



i don't know if this extension my thread represents is kool or not,
but i
want to enable my user to open a form subject to the condition the
value
of
the "Patient Number" on it is equal to a value selected by the user
on the
'Switchboard' form called 'Command and Control Center' via an unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



:

On Thu, 6 Jan 2005 07:07:02 -0800, Larry R wrote:

I have an unbound textbox on a form that I want to type some text
into
and
then filter the data showing only the records that contain the
word.
The
field I'm trying to filter is a text field called loss
description. I'm
having triouble filtering the data using wildcards. My first step
was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and
nothing
else. I
need to include all reecords that include the word lighning, so I
next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to do
this?
After I get the syntax correect, I want to replace the word
lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" & Me![ControlName]
&
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
D

Douglas J. Steele

So presumably the code that's being generated for you is using
DoCmd.OpenForm.

You can pass a Where clause using OpenForm:

DoCmd.OpenForm "MyForm", , , "Me.[Patient Number] = " & [Forms]![Command and
Control Center]![SelectPatient]


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
douglas,

i'm using the switchboard wizard's option to open it using 'Open Form'
from
the dropdown menu's list of choices.

-ted


Douglas J. Steele said:
How are you opening the form? If you're using DoCmd.OpenForm, you can
specify the filter then.

Otherwise, rather than the DoCmd.ApplyFilter, you could try:

Me.Filter = "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
Me.FilterOn = True

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
just a quick addendum.....

i have tried this both in an 'OnOpen' and 'OnLoad' event property --
thie
latter which i have to think is the more appropriate decision; in that
instance, i get a Parameter query asking for "Me.Patient Number". does
it
have anything at all to do with the control's being a combobox in both
instances?

-ted


:

douglas,

here's my text

DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

note the ',' i put after the 'ApplyFilter' per the a2k help
docu'n.....yet,
still it doesn't open to the chosen Patient Number from the
switchboard?

-te


:

Try putting the control name outside of the quotes, to ensure you
get
its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good
idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



i don't know if this extension my thread represents is kool or not,
but i
want to enable my user to open a form subject to the condition the
value
of
the "Patient Number" on it is equal to a value selected by the
user
on the
'Switchboard' form called 'Command and Control Center' via an
unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and
Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



:

On Thu, 6 Jan 2005 07:07:02 -0800, Larry R wrote:

I have an unbound textbox on a form that I want to type some
text
into
and
then filter the data showing only the records that contain the
word.
The
field I'm trying to filter is a text field called loss
description. I'm
having triouble filtering the data using wildcards. My first
step
was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and
nothing
else. I
need to include all reecords that include the word lighning, so
I
next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to
do
this?
After I get the syntax correect, I want to replace the word
lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Me![ControlName]
&
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
G

Guest

i know this is elemental but i'm getting an error 13 when i use

DoCmd.ApplyFilter , "[Patient Number] = " & _
[Forms]![Command and Control Center]![SelectPatient And [Cycle_] = 0

[note the new interest in filtering jointly on the input value and the
'Cycle_' of zero]is the error in the syntax above?



Douglas J. Steele said:
So presumably the code that's being generated for you is using
DoCmd.OpenForm.

You can pass a Where clause using OpenForm:

DoCmd.OpenForm "MyForm", , , "Me.[Patient Number] = " & [Forms]![Command and
Control Center]![SelectPatient]


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
douglas,

i'm using the switchboard wizard's option to open it using 'Open Form'
from
the dropdown menu's list of choices.

-ted


Douglas J. Steele said:
How are you opening the form? If you're using DoCmd.OpenForm, you can
specify the filter then.

Otherwise, rather than the DoCmd.ApplyFilter, you could try:

Me.Filter = "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
Me.FilterOn = True

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



just a quick addendum.....

i have tried this both in an 'OnOpen' and 'OnLoad' event property --
thie
latter which i have to think is the more appropriate decision; in that
instance, i get a Parameter query asking for "Me.Patient Number". does
it
have anything at all to do with the control's being a combobox in both
instances?

-ted


:

douglas,

here's my text

DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

note the ',' i put after the 'ApplyFilter' per the a2k help
docu'n.....yet,
still it doesn't open to the chosen Patient Number from the
switchboard?

-te


:

Try putting the control name outside of the quotes, to ensure you
get
its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good
idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



i don't know if this extension my thread represents is kool or not,
but i
want to enable my user to open a form subject to the condition the
value
of
the "Patient Number" on it is equal to a value selected by the
user
on the
'Switchboard' form called 'Command and Control Center' via an
unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and
Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



:

On Thu, 6 Jan 2005 07:07:02 -0800, Larry R wrote:

I have an unbound textbox on a form that I want to type some
text
into
and
then filter the data showing only the records that contain the
word.
The
field I'm trying to filter is a text field called loss
description. I'm
having triouble filtering the data using wildcards. My first
step
was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and
nothing
else. I
need to include all reecords that include the word lighning, so
I
next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way to
do
this?
After I get the syntax correect, I want to replace the word
lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Me![ControlName]
&
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
D

Douglas J. Steele

You would appear to be missing the final closing bracket on SelectPatient,
and the rest of the clause isn't in parentheses:

DoCmd.ApplyFilter , "[Patient Number] = " & _
[Forms]![Command and Control Center]![SelectPatient] & " And [Cycle_] =
0"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
i know this is elemental but i'm getting an error 13 when i use

DoCmd.ApplyFilter , "[Patient Number] = " & _
[Forms]![Command and Control Center]![SelectPatient And [Cycle_] = 0

[note the new interest in filtering jointly on the input value and the
'Cycle_' of zero]is the error in the syntax above?



Douglas J. Steele said:
So presumably the code that's being generated for you is using
DoCmd.OpenForm.

You can pass a Where clause using OpenForm:

DoCmd.OpenForm "MyForm", , , "Me.[Patient Number] = " & [Forms]![Command
and
Control Center]![SelectPatient]


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
douglas,

i'm using the switchboard wizard's option to open it using 'Open Form'
from
the dropdown menu's list of choices.

-ted


:

How are you opening the form? If you're using DoCmd.OpenForm, you can
specify the filter then.

Otherwise, rather than the DoCmd.ApplyFilter, you could try:

Me.Filter = "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
Me.FilterOn = True

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



just a quick addendum.....

i have tried this both in an 'OnOpen' and 'OnLoad' event property --
thie
latter which i have to think is the more appropriate decision; in
that
instance, i get a Parameter query asking for "Me.Patient Number".
does
it
have anything at all to do with the control's being a combobox in
both
instances?

-ted


:

douglas,

here's my text

DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

note the ',' i put after the 'ApplyFilter' per the a2k help
docu'n.....yet,
still it doesn't open to the chosen Patient Number from the
switchboard?

-te


:

Try putting the control name outside of the quotes, to ensure you
get
its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good
idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



i don't know if this extension my thread represents is kool or
not,
but i
want to enable my user to open a form subject to the condition
the
value
of
the "Patient Number" on it is equal to a value selected by the
user
on the
'Switchboard' form called 'Command and Control Center' via an
unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and
Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



:

On Thu, 6 Jan 2005 07:07:02 -0800, Larry R wrote:

I have an unbound textbox on a form that I want to type some
text
into
and
then filter the data showing only the records that contain
the
word.
The
field I'm trying to filter is a text field called loss
description. I'm
having triouble filtering the data using wildcards. My first
step
was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and
nothing
else. I
need to include all reecords that include the word lighning,
so
I
next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way
to
do
this?
After I get the syntax correect, I want to replace the word
lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Me![ControlName]
&
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 
G

Guest

thanks doug, i see the this now.

i couldn't have done it w/o you.

again, this discussion group is tops in my book!

all the best,

-ted



Douglas J. Steele said:
You would appear to be missing the final closing bracket on SelectPatient,
and the rest of the clause isn't in parentheses:

DoCmd.ApplyFilter , "[Patient Number] = " & _
[Forms]![Command and Control Center]![SelectPatient] & " And [Cycle_] =
0"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ted said:
i know this is elemental but i'm getting an error 13 when i use

DoCmd.ApplyFilter , "[Patient Number] = " & _
[Forms]![Command and Control Center]![SelectPatient And [Cycle_] = 0

[note the new interest in filtering jointly on the input value and the
'Cycle_' of zero]is the error in the syntax above?



Douglas J. Steele said:
So presumably the code that's being generated for you is using
DoCmd.OpenForm.

You can pass a Where clause using OpenForm:

DoCmd.OpenForm "MyForm", , , "Me.[Patient Number] = " & [Forms]![Command
and
Control Center]![SelectPatient]


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



douglas,

i'm using the switchboard wizard's option to open it using 'Open Form'
from
the dropdown menu's list of choices.

-ted


:

How are you opening the form? If you're using DoCmd.OpenForm, you can
specify the filter then.

Otherwise, rather than the DoCmd.ApplyFilter, you could try:

Me.Filter = "Me.[Patient Number] = " & [Forms]![Command and Control
Center]![SelectPatient]
Me.FilterOn = True

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



just a quick addendum.....

i have tried this both in an 'OnOpen' and 'OnLoad' event property --
thie
latter which i have to think is the more appropriate decision; in
that
instance, i get a Parameter query asking for "Me.Patient Number".
does
it
have anything at all to do with the control's being a combobox in
both
instances?

-ted


:

douglas,

here's my text

DoCmd.ApplyFilter , "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

note the ',' i put after the 'ApplyFilter' per the a2k help
docu'n.....yet,
still it doesn't open to the chosen Patient Number from the
switchboard?

-te


:

Try putting the control name outside of the quotes, to ensure you
get
its
value:

DoCmd.ApplyFilter "Me.[Patient Number] = " & [Forms]![Command and
Control
Center]![SelectPatient]

(And no, tacking your question onto another thread isn't a good
idea)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



i don't know if this extension my thread represents is kool or
not,
but i
want to enable my user to open a form subject to the condition
the
value
of
the "Patient Number" on it is equal to a value selected by the
user
on the
'Switchboard' form called 'Command and Control Center' via an
unbound
combox.
so i use this string in the OnOpen property

DoCmd.ApplyFilter "Me.[Patient Number] = [Forms]![Command and
Control
Center]![SelectPatient]"

can somebody venture a guess as to why it doesn't do the job.

-ted



:

On Thu, 6 Jan 2005 07:07:02 -0800, Larry R wrote:

I have an unbound textbox on a form that I want to type some
text
into
and
then filter the data showing only the records that contain
the
word.
The
field I'm trying to filter is a text field called loss
description. I'm
having triouble filtering the data using wildcards. My first
step
was
to use
the following expression:
DoCmd.ApplyFilter , "[Loss Description] = 'lightning'"

This only works if the field contains the word lightning and
nothing
else. I
need to include all reecords that include the word lighning,
so
I
next
tried:
DoCmd.ApplyFilter , "[Loss Description] = '* lightning *'"

But that doesn't yield any results. Is there a simple way
to
do
this?
After I get the syntax correect, I want to replace the word
lightning
with a
refernce to a user text box on the form called Txtkeyword.

DoCmd.ApplyFilter , "[Loss Description] Like '*lightning*'"

If the code is on the form "Txtkeyword":
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Me![ControlName]
&
"*'"

If the code is on a different form:
DoCmd.ApplyFilter , "[Loss Description] Like '*" &
Forms!Txtkeyword![ControlName] & "*'"
 

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

Similar Threads

DoCmd ApplyFilter performing funny 3
Trying to ApplyFilter to form 3
applyfilter with a wildcard 1
Docmd Set Filter 4
ApplyFilter question 1
applyFilter 1
Applyfilter issue 3
ApplyFilter to Form 1

Top