LIKE WITH * value * on join

User avatar
sal21
PlatinumLounger
Posts: 4362
Joined: 26 Apr 2010, 17:36

LIKE WITH * value * on join

Post by sal21 »

Code: Select all

... ON TAB.DENOM LIKE * TAB1.NOMINATIVO *
i need to use a like on a entire filed TAB1.NOMINATIVO... similar * TAB1.NOMINATIVO *

is this correct?

note:
i need to use in Access Ide

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: LIKE WITH * value * on join

Post by HansV »

Try

Code: Select all

... ON TAB.DENOM LIKE '*' & TAB1.NOMINATIVO & '*'
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4362
Joined: 26 Apr 2010, 17:36

Re: LIKE WITH * value * on join

Post by sal21 »

HansV wrote:Try

Code: Select all

... ON TAB.DENOM LIKE '*' & TAB1.NOMINATIVO & '*'
OK TKS!

2 qstions:
1)
is the same to use the like statement TAB.DENOM similar:
2)
the like statement match:

sal oppppp and opppp
sal opppppppp and opp



ops, correct now?
]... ON 'like *' & TAB.DENOM & '* = TAB1.NOMINATIVO
Last edited by sal21 on 16 Jan 2014, 12:46, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: LIKE WITH * value * on join

Post by HansV »

1) Wildcards * and/or ? work only with LIKE, not with =.

2) Yes.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4362
Joined: 26 Apr 2010, 17:36

Re: LIKE WITH * value * on join

Post by sal21 »

HansV wrote:1) Wildcards * and/or ? work only with LIKE, not with =.

2) Yes.

my result whith your code return nothing!!!!!

in effect i need to mach:

tab1 tab2
mario rossi > rossi mario
bianchi mario > mario bianchi
bianchi > bianc

is correct your attement to match the value in example?

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: LIKE WITH * value * on join

Post by HansV »

You can't match "mario rossi" with "rossi mario" using = or Like. You'll have to 'clean' the data so that they are all in a consistent format, either "firstname lastname", or "lastname firstname", but not a mixture of both. Even better would be to store first name in one field and last name in another field.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4362
Joined: 26 Apr 2010, 17:36

Re: LIKE WITH * value * on join

Post by sal21 »

HansV wrote:You can't match "mario rossi" with "rossi mario" using = or Like. You'll have to 'clean' the data so that they are all in a consistent format, either "firstname lastname", or "lastname firstname", but not a mixture of both. Even better would be to store first name in one field and last name in another field.
Instr in field help me?

Hummmm i cannot store in sepsrate field name and last nname i dont know the sequence in single field. I csn have in a field name an last name and in other field a mix....

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: LIKE WITH * value * on join

Post by HansV »

There's no easy solution for your problem.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4362
Joined: 26 Apr 2010, 17:36

Re: LIKE WITH * value * on join

Post by sal21 »

HansV wrote:There's no easy solution for your problem.
Peraph firts steep...

...
Dim ShowInfo() As String
TEST = RS1.Fields(0).Value
ShowInfo = Split(TEST, " ")
...

only a prob.

the string in TEST have a variable block o sub string:

similar:

AAAA BBBB
DDD BBB GGG

how to loop with ubound count ShowInfo?

and return:

BBBB AAAA
GGG BBB DDD

in effect TEST is Lastname and name

and i need

Nmae Lastname

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: LIKE WITH * value * on join

Post by HansV »

How many records do you need to process?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4362
Joined: 26 Apr 2010, 17:36

Re: LIKE WITH * value * on join

Post by sal21 »

HansV wrote:How many records do you need to process?

APPROX 100

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: LIKE WITH * value * on join

Post by HansV »

OK, that's manageable. Try this:

Code: Select all

    Dim ShowInfo() As String
    TEST = RS1.Fields(0).Value
    ShowInfo = Split(TEST, " ")
    Select Case UBound(ShowInfo)
        Case 1 ' 2 parts
            TEST = ShowInfo(1) & " " & ShowInfo(0)
        Case 2 ' 3 parts
            TEST = ShowInfo(2) & " " & ShowInfo(1) & " " & ShowInfo(0)
        Case Else ' 1 part or more than 3
            ' Leave alone
    End Select
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4362
Joined: 26 Apr 2010, 17:36

Re: LIKE WITH * value * on join

Post by sal21 »

HansV wrote:OK, that's manageable. Try this:

Code: Select all

    Dim ShowInfo() As String
    TEST = RS1.Fields(0).Value
    ShowInfo = Split(TEST, " ")
    Select Case UBound(ShowInfo)
        Case 1 ' 2 parts
            TEST = ShowInfo(1) & " " & ShowInfo(0)
        Case 2 ' 3 parts
            TEST = ShowInfo(2) & " " & ShowInfo(1) & " " & ShowInfo(0)
        Case Else ' 1 part or more than 3
            ' Leave alone
    End Select

as usual you read n my "mind"!
Perfect.
:thankyou: :thankyou: :clapping: