If you 'have not spread the same data across fields', why do you need to
search in multiple fields?
Even if you have employee names, project names, ...in their respective
fields, what will being able to find "something name" allow you to do?
Regards
Jeff Boyce
Microsoft Office/Access MVP
I'm not sure what you mean, Jerry. You may have misunderstood me. I
have not spread the same data across fields.
For example, in my actual database, I have employee names in one
field, project names in another, product names in a third, and so on.
I'm open to suggestions on design, but I think the db is designed
pretty rationally.
What I'm trying to do is provide a single, Google-like search box on a
space-limited form such that the user doesn't need to specify what
field he's searching in. So, for example, if he wants to query the db
for an employee called Jerry Whittle, he could put Whitt into my
search box and get back a report with records some field of which
matched "*Whitt*". Just as when you do a Google search, you get
results that aren't quite what you're looking for, it is possible he
might get back some records that have, say, product names with the
string Whitt in them, but that's okay.
Is it wrong of me to want such a search box?
If not, then I would still like some way to specify a wild card
field...or the equivalent, so I don't need to provide a lengthy
expression specifying every last field in my table.
Thanks,
TI
You have discovered a basic inner mystery of good database and table
design.
If you have fields for particular data such as different years, you will
have
problems searching for it. If you add fields, such as for year 2010, you
will
need to change your queries, forms, and reports. And it will never get
easier
or be right.
Instead of something like Years across the fields like
Year2009 Year2010 etc.,
$2341 $9876
you want a Years column with the data down like:
Years Amount
2009 $2341
2010 $9876
Always keep the same data in one field in one table. Another way to look
at
it, if you have data, such as the Year, in the field name, you probably
are
going the wrong way with the table design especially if you see similar
named
fields going across.
If you have all the same data in one field in one table, finding it is
simple.
tryit said:
Hi All,
I am searching my table as follows:
SELECT Table1.ID, Table1.field1, Table1.field2
FROM Table1
WHERE (((
[Table1]![field1] Like "*" & [Forms]![SearchForm]![txtSearch] & "*"
Or [Forms]![SearchForm]![txtSearch] Is Null
Or
[Table1]![field2] Like "*" & [Forms]![SearchForm]![txtSearch] & "*" Or
[Forms]![SearchForm]![txtSearch] Is Null)
=True));
The problem is that I want this search to search all fields in my
table. So, every time I add a field, I have to add a new field and a
new line like:
[Table1]![NEWFIELD] Like "*" & ... etc.
Is there any way I can just put some sort of wild card in here?, like:
[Table1]![*] Like "*" & ... etc.
And be done with it??? --Or the equivalent? Putting a star there
doesn't seem to work.
Thanks,
TI