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] & "*'"