Dear 1308:
Nope.
If these 15 columns contain "equivalent" information, such as would
typically be the case if you want to search them all simultaneously for the
same thing, then that indicates your database is built improperly. You
chouls put all 15 fields into one field, but in 15 separate rows. The
search would then be of a single column.
If your current structure is like this:
Key Column
Some Attribute
Text 1
Text 2
Text 3
and so on, up to 15, then you should make two tables from this:
Key Column
Some Attribute
and
Key Column
Sequence
Text
If done this way, searches such as you describe will work well. Not having
"repeating" rows in a table is a rule of good design.
You can make your current setup appear to be this way using a UNION query:
SELECT [Key Column], 1 AS Sequence, [Text 1] AS Text
FROM YourTable
WHERE [Text 1] IS NOT NULL
UNION ALL
SELECT [Key Column], 2 AS Sequence, [Text 2] AS Text
FROM YourTable
WHERE [Text 2] IS NOT NULL
UNION ALL
SELECT [Key Column], 3 AS Sequence, [Text 3] AS Text
FROM YourTable
WHERE [Text 3] IS NOT NULL
UNION ALL
SELECT [Key Column], 4 AS Sequence, [Text 4] AS Text
FROM YourTable
WHERE [Text 4] IS NOT NULL
Repeat this till you have all 15 text values. You can then query the single
column in this to locate all matching strings.
Tom Ellison
accessuser1308 said:
I currently have a form/table with 15 different fields, that can hold
similar
information. I know I can search a single field for a specific
word/phrase.
Is there a way (with a macro or code) that I can enter the word or phrase
I
am looking for...have it search field 1, if not found move on to field 2,
and
so on until it has searched all fields and/or found all occurances in the
different fields?
Thank you!