"Like" fucntion in VBA

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
 
D

Douglas J. Steele

Like works in VBA.

?"ABC" Like "*B*"
True
?"ABC" Like "B*"
False
?"ABC" Like "?B*"
True
 
S

Shane S via AccessMonster.com

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top