A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Problem Passing Parameter from Form



 
 
Thread Tools Display Modes
  #1  
Old March 15th, 2010, 05:41 PM posted to microsoft.public.access.queries
autigger
external usenet poster
 
Posts: 1
Default Problem Passing Parameter from Form

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?

  #2  
Old March 15th, 2010, 05:57 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Problem Passing Parameter from Form

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.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"autigger" wrote:

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?

  #3  
Old March 15th, 2010, 06:57 PM posted to microsoft.public.access.queries
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Problem Passing Parameter from Form

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.

"autigger" wrote in message
...
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?



  #4  
Old March 15th, 2010, 09:23 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Problem Passing Parameter from Form

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

autigger wrote:
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?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.