473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

need help w/ LIKE and a parameter

I have a query called, say, "foo",
which is just a join of tables "x", "y", and "z",
with a couple of redundant index fields not included.

Basically, I want to look at *only* this query,
not the underlying tables.

All of the fields in "foo" are of type "Text" except "g",
which is of type "Memo".

I have created a bunch of queries that looks like this:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.a)=[A?"]));
--------
These all work. For these, I am interested only in exact matches.

However, for field "g" I want a wildcard match.
I cooked up the following:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.g) Like '%'+[G contains?]+'%'));
--------
It doesn't work, of course.
I get the little "Enter Parameter Value" dialog box,
and I enter a value that is contained in the "g" field of many rows, but:
When I click the [OK] button,
I get a table with the appropriate column headings,
and one blank row, and then nothing.

Note that I'm just building ordinary conditiona queries here.
I'm not interested in forms or reports at this time --
I'll get to that later.

Can anyone tell me what I *should* be doing?

Thanks.
Feb 5 '07 #1
2 1374
If your query is running under DAO, * is the wildcard character. See whether
using * as the wildcard character (rather than %) works any better.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"scenic_man" <zc*******@sneakemail.comwrote in message
news:7Fuxh.2204$yH3.654@trndny07...
>I have a query called, say, "foo",
which is just a join of tables "x", "y", and "z",
with a couple of redundant index fields not included.

Basically, I want to look at *only* this query,
not the underlying tables.

All of the fields in "foo" are of type "Text" except "g",
which is of type "Memo".

I have created a bunch of queries that looks like this:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.a)=[A?"]));
--------
These all work. For these, I am interested only in exact matches.

However, for field "g" I want a wildcard match.
I cooked up the following:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.g) Like '%'+[G contains?]+'%'));
--------
It doesn't work, of course.
I get the little "Enter Parameter Value" dialog box,
and I enter a value that is contained in the "g" field of many rows, but:
When I click the [OK] button,
I get a table with the appropriate column headings,
and one blank row, and then nothing.

Note that I'm just building ordinary conditiona queries here.
I'm not interested in forms or reports at this time --
I'll get to that later.

Can anyone tell me what I *should* be doing?

Thanks.

Feb 5 '07 #2
On Mon, 05 Feb 2007 00:13:55 GMT, scenic_man
<zc*******@sneakemail.comwrote:
>I have a query called, say, "foo",
which is just a join of tables "x", "y", and "z",
with a couple of redundant index fields not included.

Basically, I want to look at *only* this query,
not the underlying tables.
The query has no independent existance. If you want to look at the
data you MUST look at the tables, because that's where the data is. A
Query is just a way to select and combine data from one or more
tables.
>All of the fields in "foo" are of type "Text" except "g",
which is of type "Memo".

I have created a bunch of queries that looks like this:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.a)=[A?"]));
--------
These all work. For these, I am interested only in exact matches.

However, for field "g" I want a wildcard match.
I cooked up the following:
========
SELECT foo.a, foo.b, foo.c, foo.d, foo.e, foo.f, foo.g
FROM foo
WHERE (((foo.g) Like '%'+[G contains?]+'%'));
--------
In Access, you need to use * rather than % as the wildcard character.

John W. Vinson [MVP]
Feb 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
3
by: news.rcn.com | last post by:
How can I access the request and response object for a page using javascript. I want to stick some data on with something like request.setAttribute( "User's choice for later use" ). I can't seem...
11
by: Micha | last post by:
Hello there, I think I've run into some classic c++ pitfall and maybe some of you guys can help me out. For my project I will need to use matrices and vectors and so I decided to implement them...
3
by: Ellie O'Donnell | last post by:
Hi, I wrote a DB2 stored procedure in COBOL, and now I need to prepare a CLIST in order to call it. This CLIST would be for people who want to use the stored procedure outside of COBOL or Pl/I....
7
by: ÀÏÆÅ»³ÔÐ5¸öÔ | last post by:
I want use dropdownlist contral in gridview but have trouble now mycode here: i'm very sorry for my poor english <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"...
1
by: Billg_sd | last post by:
It's been awhile since I've had to work with XML in VB.Net. Look at the following snippet: <Parameters> <Parameter>123</Parameter> <Parameter>456</Parameter> </Parameters> How do I find...
46
by: Bruce W. Darby | last post by:
This will be my very first VB.Net application and it's pretty simple. But I've got a snag in my syntax somewhere. Was hoping that someone could point me in the right direction. The history: My...
2
by: Bill | last post by:
I have a 200 record database that includes a date/time field, AnnivDate, for a wedding anniversary. AnnivDate has nulls and some incorrect year data. I have been creating the Access database...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
2
by: mturner64 | last post by:
Good Day! I am fairly new to asp.net. I am using Microsoft VWD 2008 express edition. I have linked an Access 2007 database to my asp.net application using a gridview control. On the webpage are...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.