Problem Passing Parameter from Form

  • Thread starter Thread starter autigger
  • Start date Start date
A

autigger

If I hard code in the following into the critera:
Like [!T]*
Any record that starts with T is not returned.
If I pass the same thing, [!T]*, from a form to:
Like [Forms]![frmTest]![Name]
Nothing is returned. Why can’t I pass, [!T]* from the form and get the same
results as if I hardcode it into the criteria?
 
When you pass it from a form, Access sees it as a string. It looks like:
"[!T]*" which isn't the same thing as [!T]*.

You might be able to create an SQL statement in a VBA module and get it to
work correctly.
 
Another possibility ... try using the Evaluate() function to see if you can
persuade Access to treat what you are passing as criteria, not a string.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
That should work. Even if you enter [!T]* as criteria, it will get changed to
Like "[!T]*"
by the expression service

So the question might be to check and see exactly what is being passed in.
Put [Forms]![frmTest]![Name] in as a calculated field with no criteria where
you are presently inputting the criteria and see what the query returns.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top