Im looking for a function that does the same as the like function in queries (eg like "*a*" would show everything containing the letter a) but for vba code.
Im looking for a function that does the same as the like function in queries (eg like "*a*" would show everything containing the letter a) but for vba code.
thanks for all your help so far... The way im trying to use it is to set a link criteria for an openForm command. I basically need to set the form to open where RecNo = Me.RecNo, RevNo = Me.RevNo and Description is like "1 -*"
So far ive tried:
stLinkCriteria = "[RecNo]= '" & Me![RecNo] & "' And [RevNo]= " & Me![RevNo] & "And [Description] like '1 -*'"
strWhere = strWhere & "([Name] Like ""*" & Me.txname & "*"") AND "
'See if the string has more than 5 characters (a trailng " AND ") to remove.
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'Nah: there was nothing in the string.
MsgBox "No criteria", vbInformation, "Nothing to do."
Else 'Yep: there is something there, so remove the " AND " at the end.
strWhere = Left$(strWhere, lngLen)
Courtesy: allenbrowne page.
txtname contains ur serach criteria in ur case "a"...