Comparing part of the field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm comparing to fields to find matched entries. The problem is that I want to compare the first field with any part of the second field (not the whole field). For example:
FIELD1 FIELD2
4D6_GAS_COMP 40*4D6_GAS_COMP:31PSLO101B.OUT
26PIT038 (26PIT038:PV-101.325)/100

I need to compare the field 1 with any part of the field 2, so the entries in the example match
How could I do this?

Thanks in advance
 
something like...

Where [Field1] like "*" & [Field1] & "*"





Rick B


I'm comparing to fields to find matched entries. The problem is that I want
to compare the first field with any part of the second field (not the whole
field). For example:
FIELD1 FIELD2
4D6_GAS_COMP 40*4D6_GAS_COMP:31PSLO101B.OUT
26PIT038 (26PIT038:PV-101.325)/100

I need to compare the field 1 with any part of the field 2, so the entries
in the example match
How could I do this?

Thanks in advance
 
Oops...

Where [Field2] like "*" & [Field1] & "*"

something like...

Where [Field1] like "*" & [Field1] & "*"





Rick B


I'm comparing to fields to find matched entries. The problem is that I want
to compare the first field with any part of the second field (not the whole
field). For example:
FIELD1 FIELD2
4D6_GAS_COMP 40*4D6_GAS_COMP:31PSLO101B.OUT
26PIT038 (26PIT038:PV-101.325)/100

I need to compare the field 1 with any part of the field 2, so the entries
in the example match
How could I do this?

Thanks in advance
 
Or use InStr() function.
Pituslang said:
I'm comparing to fields to find matched entries. The problem is that I
want to compare the first field with any part of the second field (not the
whole field). For example:
 
You need to use Like "*" & [Field2] & "*"

What you have is looking for the literal [Field2] anywhere in the field
name.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


pituslang said:
I've tried those methods, but it didn't work.
I've created a query in Design view and added the fields 1 and 2 (they are
from different tables). In the field1, I add the criteria <<Like
"*[Field2]*">> and I don't get any match (and I have checked that there are
at least 3 matches)
I don't know how I have to use the InStr() function or <<Like
"*[Field2]*">> . Where do I have to add this? I only know how to do simples
queries, not how to use this fields
want to compare the first field with any part of the second field (not the
whole field). For example:
 
Back
Top