select all fields that contain textbox value (1 Viewer)

bbwolff

Registered User.
Local time
Today, 13:49
Joined
Oct 1, 2013
Messages
116
I'd like user to input what he's looking for in a textbox and then to filter all the records that contain that word.

values could be like rome, paris, belgrade
when user inputs rome, all fields containing rome should appear

tblTest like '%rome%'
should this work

tblTest like '" & Me.txtTest & "'
tblTest like '%" & Me.txtTest & "%' "

these give filters in report respectively :
tblTest like 'rome'
tblTest like '%rome%'

I might have something else wrong, but i don't get the desired results. No records are displayed
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:49
Joined
Jan 23, 2006
Messages
15,379
I read another of your posts re storing multiple values in one field. I recommend you don't do that. I think you will be happier (easier to maintain, easier to get help with) if you normalized your table.

When you say "filter records that contain that word", do you mean in a specific field or in any field?

Your sample
Code:
tblTest like '%rome%'
What do you think/want this to do?

Also, Access uses "*" as the wildcard symbol.

...somefield like "*" & Me.txtTest &"*'....
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 21:49
Joined
Jan 20, 2009
Messages
12,852
when user inputs rome, all fields containing rome should appear

Searching across all fields generally indicates that the data structure is incorrect.

You should post a description of your tables to get advice on structural corrections before you go any further down the wrong path.
 

bbwolff

Registered User.
Local time
Today, 13:49
Joined
Oct 1, 2013
Messages
116
i agree with what you're all saying ;) and i'm looking into it, but right now i have such a simple solution that I'm really reluctant to let it go.
basically i'm adding keywords to records, each user can define as many as he wants on the fly. i could save all these in a separate table, add colums for each new keyword etc... there will usually be just one keyword (or none) per record, very rarely more then two.
I'm storing all these in one field in a table for now.

* in place of % did the trick, tx
 

Users who are viewing this thread

Top Bottom