"Like" fucntion in VBA

  • Thread starter Thread starter Daveo
  • Start date Start date
D

Daveo

Hi there,

Could anyone please tell me what the equivalent is in VBA of the "Like"
function that you can use in query criteria etc. and the correct syntax
for using it?

Many thanks - David
 
Like works in VBA.

?"ABC" Like "*B*"
True
?"ABC" Like "B*"
False
?"ABC" Like "?B*"
True
 
Hey Dave,

Here's a snippet of code that I use on one of my search forms. I think it
may let you see what your asking.
Hope it helps.

Select Case Me.optFind
Case 1
stWhere = stWhere & stActive & " AND Orders.
Equipment" & _
" LIKE '*" & Me!
[txtEquip] & "*'"
Case 2
stWhere = stWhere & " AND ((Not (Orders.PIFDate)
Is Null)) AND Orders.Equipment" & _
" LIKE '*" & Me!
[txtEquip] & "*'"
Case 3
stWhere = stWhere & " AND Orders.Equipment" & _
" LIKE '*" & Me!
[txtEquip] & "*'"
End Select
 
Back
Top