Problem Passing Parameter from Form

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?
 
J

Jerry Whittle

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.
 
J

Jeff Boyce

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.
 
J

John Spencer

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
 

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