Help With Query

  • Thread starter Thread starter TomC
  • Start date Start date
T

TomC

Here is what I am having trouble with.
I am using a query to find info based on a text field on a form.

This is my query and it works fine.. Class is the text field.
[Forms]![PageOne]![Class]

What I need to do is query using any part of the table record for the
string Class.

I have PH1 PH2 PH6 in the table. If I enter PH2 in the Class text
field I want to bring up all the records that have this in them.
I am trying to search the whole string for just part of the string. I
hope I am not babbling here.

Any one that can understand this please help.


....Thanks In Adavance
 
Tom,

Generally speaking...
WHERE myField LIKE [Forms]![PageOne]![Class]

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Here is what I am having trouble with.
I am using a query to find info based on a text field on a form.

This is my query and it works fine.. Class is the text field.
[Forms]![PageOne]![Class]

What I need to do is query using any part of the table record for the
string Class.

I have PH1 PH2 PH6 in the table. If I enter PH2 in the Class text
field I want to bring up all the records that have this in them.
I am trying to search the whole string for just part of the string. I
hope I am not babbling here.

If you're storing three values in one field - YOUR TABLE STRUCTURE IS
WRONG. Fields should be "atomic" - they should have one and only one
piece of information in each field. That's why you're having trouble!

You can do this with the current structure by using a criterion of

LIKE "*" & [Forms]![PageOne]![Class] & "*"

The LIKE operator recognize * as a wildcard so it will find PH2 no
matter where it is in the field.

However, you should really consider restructuring your table so that
you have a one-to-many relationship between two tables, rather than
jamming a one-to-many relationship in a single field!
 
Back
Top