Not Like in vba

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

Guest

Hi, probably a very simple one but can you not use not like in vba? I'm
trying to say:

If Not IsNull(rst![Last Audit]) And rst!RANK not like "Gr*" Then

but it won't compile.

Thanks in advance for any help.
Sue
 
hughess7 said:
Hi, probably a very simple one but can you not use not like in vba? I'm
trying to say:

If Not IsNull(rst![Last Audit]) And rst!RANK not like "Gr*" Then

but it won't compile.


THat grammer is ok in SQL or in control source expressions,
but not in VBA. Write it this way:

If Not IsNull(rst![Last Audit]) And Not rst!RANK Like "Gr*"
Then
 
I would write it like this:
If Not IsNull(rst![Last Audit]) And Left(rst!RANK,2) <> "Gr"

Marshall Barton said:
hughess7 said:
Hi, probably a very simple one but can you not use not like in vba? I'm
trying to say:

If Not IsNull(rst![Last Audit]) And rst!RANK not like "Gr*" Then

but it won't compile.


THat grammer is ok in SQL or in control source expressions,
but not in VBA. Write it this way:

If Not IsNull(rst![Last Audit]) And Not rst!RANK Like "Gr*"
Then
 
If Not IsNull(rst![Last Audit]) And Not rst!RANK Like "Gr*"
Then
I would write it like this:
If Not IsNull(rst![Last Audit]) And Left(rst!RANK,2) <> "Gr"

If Not (IsNull(rst![Last Audit]) Or Left(rst!Rank, 2)="Gr") Then

B Wishes


Tim F
 
Thanks guys for all your suggestions, now working :-)

Sue


Tim Ferguson said:
If Not IsNull(rst![Last Audit]) And Not rst!RANK Like "Gr*"
Then
I would write it like this:
If Not IsNull(rst![Last Audit]) And Left(rst!RANK,2) <> "Gr"

If Not (IsNull(rst![Last Audit]) Or Left(rst!Rank, 2)="Gr") Then

B Wishes


Tim F
 
Back
Top