Connecting Tech Pros Worldwide Forums | Help | Site Map

Proper "LIKE" Syntax

Rick Brown
Guest
 
Posts: n/a
#1: Nov 12 '05
I'm trying to scan a barcode that contains the text string
"BPWOT08762" into a textbox for use in a DLookup or query grid.

I want to look thru a table's field that contains the last 6
characters of the barcode plus a 1 character prefix.


Test Data in table:

SerialNumber
MP40789
MP39718
S583424
MT08762 <<<<<<<<<<<<<<
S581724
MP39048
MP37338
S583199
MP37584


I want to return the seven character serial number(MT08762) from the
table.

The return will be used in a Labels textbox.

I've tried to do this in a query grid but can't get the syntax right.

Failed attempt follows: Like '*" &
right([Forms]![Form1]![SerialNumber],6) & "'

I can code if required.(sort of)<g>

TIA, Rick

Jim Allensworth
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Proper "LIKE" Syntax


On 20 Nov 2003 14:42:27 -0800, rbrowniii@compuserve.com (Rick Brown)
wrote:
[color=blue]
>I'm trying to scan a barcode that contains the text string
>"BPWOT08762" into a textbox for use in a DLookup or query grid.
>
>I want to look thru a table's field that contains the last 6
>characters of the barcode plus a 1 character prefix.
>
>
>Test Data in table:
>
>SerialNumber
>MP40789
>MP39718
>S583424
>MT08762 <<<<<<<<<<<<<<
>S581724
>MP39048
>MP37338
>S583199
>MP37584
>
>
>I want to return the seven character serial number(MT08762) from the
>table.
>
>The return will be used in a Labels textbox.
>
>I've tried to do this in a query grid but can't get the syntax right.
>
>Failed attempt follows: Like '*" &
>right([Forms]![Form1]![SerialNumber],6) & "'
>
>I can code if required.(sort of)<g>
>[/color]

It looks like you have a mix of single and double quotes: Try...
Like "*" & right([Forms]![Form1]![SerialNumber],6)


- Jim

Closed Thread