Using Like in expression

  • Thread starter Thread starter edi
  • Start date Start date
E

edi

I'm using Access 2000.
I have the following expression:
Expr1: IIf([Status]="ACT" Or [Status]="NYP","AC",[STATUS])

Can I use a Like A* statement to select records beginiing with A*? I can't
figure out the syntax. And can I also also only select those records
beginning with an A and the second letter is a numeral.I have the following
list
A01
A12
A29
ABO
ADO
Cheers
 
Try:

Expr1: IIf(([Status] Like "A*") Or ([Status] = "NYP"), "AC", [STATUS])

Note that if the data is not in JET (e.g. in attached SQL Server tables),
you need to use % as the wildcard instead of *.
 
PMFBI

the "second letter is a numeral" is a snap

Like "A[0-9]*"

Apologies again for butting in.

Allen Browne said:
Try:

Expr1: IIf(([Status] Like "A*") Or ([Status] = "NYP"), "AC", [STATUS])

Note that if the data is not in JET (e.g. in attached SQL Server tables),
you need to use % as the wildcard instead of *.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

edi said:
I'm using Access 2000.
I have the following expression:
Expr1: IIf([Status]="ACT" Or [Status]="NYP","AC",[STATUS])

Can I use a Like A* statement to select records beginiing with A*? I can't
figure out the syntax. And can I also also only select those records
beginning with an A and the second letter is a numeral.I have the following
list
A01
A12
A29
ABO
ADO
Cheers
 
Back
Top