dbTalk Databases Forums  

Selecting record set by searching for a string

comp.database.ms-access comp.database.ms-access


Discuss Selecting record set by searching for a string in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Geoff Goddard
 
Posts: n/a

Default Selecting record set by searching for a string - 09-08-2004 , 06:56 AM






I want to be able to obtain a record set from a table by searching for
two or three words that might be contained in a field within that
table. For example if a field contained the following records

Escort GL 2000
Escort Estate 2003
Escort XL 2000

I'd like to be able to obtain records that could contain:

Escort
Or
Escort 2000
Or
Escort 2003
Or
Escort Estate

Can anyone help me please?

Geoff Goddard

Reply With Quote
  #2  
Old   
Andy Davis
 
Posts: n/a

Default Re: Selecting record set by searching for a string - 09-08-2004 , 08:27 AM






The best way would be set up a query and then in that field's criteria row
type in your search criteria.
For example to find records that contain "Escort" type:
Like "Escort" in the query critera cell for that field.
To find records that contain "Escort 2000" try:
Like "Es*2*"
(The * is a wildcard operator)
To find records that contain "Escort 2003" try:
Like "Es*2003"
To find records that contain "Escort Estate" try:
Like "Es*Estate"

Use the online help facility in Access for more info on queries.

"Geoff Goddard" <geoff (AT) sunny-side (DOT) ws> wrote

Quote:
I want to be able to obtain a record set from a table by searching for
two or three words that might be contained in a field within that
table. For example if a field contained the following records

Escort GL 2000
Escort Estate 2003
Escort XL 2000

I'd like to be able to obtain records that could contain:

Escort
Or
Escort 2000
Or
Escort 2003
Or
Escort Estate

Can anyone help me please?

Geoff Goddard



Reply With Quote
  #3  
Old   
Geoff Goddard
 
Posts: n/a

Default Re: Selecting record set by searching for a string - 09-10-2004 , 03:45 AM



"Andy Davis" <ad_davis12 (AT) bigpond (DOT) com> wrote

Quote:
The best way would be set up a query and then in that field's criteria row
type in your search criteria.
For example to find records that contain "Escort" type:
Like "Escort" in the query critera cell for that field.
To find records that contain "Escort 2000" try:
Like "Es*2*"
(The * is a wildcard operator)
To find records that contain "Escort 2003" try:
Like "Es*2003"
To find records that contain "Escort Estate" try:
Like "Es*Estate"

Use the online help facility in Access for more info on queries.

"Geoff Goddard" <geoff (AT) sunny-side (DOT) ws> wrote in message
news:d9d681ee.0409080356.42405042 (AT) posting (DOT) google.com...
I want to be able to obtain a record set from a table by searching for
two or three words that might be contained in a field within that
table. For example if a field contained the following records

Escort GL 2000
Escort Estate 2003
Escort XL 2000

I'd like to be able to obtain records that could contain:

Escort
Or
Escort 2000
Or
Escort 2003
Or
Escort Estate

Can anyone help me please?

Geoff Goddard
Thanks Andy, I guess I had an inkling of what to do. I've gone a step
further by creating a form 'frmSearch' with fields Text1, Text2
....Text4

A further field 'TextSearch' concatenates these thus,

="*" & [Text1] & "*" & [Text2] & "*" & [Text3] & "*" & [Text4]

The search criterion in the query reads

Like [Forms]![frmSearch]![TextSearch]

This seems to work OK but the various elements of text have to be in
the right order.

Geoff


Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.