Is there a simple way to compare a string to a mask? I tried something like if me.JOINEDGRP <> Like "L000", but the compiler didn't like that. I'm looking for strings like "F2024".
Is there a simple way to compare a string to a mask? I tried something like if me.JOINEDGRP <> Like "L000", but the compiler didn't like that. I'm looking for strings like "F2024".
See this link for using wildcards
https://support.microsoft.com/en-us/...0-242cde582e0b
Or just use the logic?
Code:Sub NotLike() Dim strInput As String, strWord As String strWord = "David Gilmour" strInput = InputBox("Name") strInput = strInput & "*" If strWord Like strInput Then MSGBOX "input is like" Else MSGBOX "input is not like" End If End Sub
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Looking at your code, I don't understand why
if me.JOINEDGRP <> Like "S####" then
won't work? Where I'm checking for a string like "S2024"
I thought you had already discovered that <> Like does not work?![]()
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Well, I didn't have the wild characters correct. Again, if your "If strWord Like strInput Then" compiles correctly, why wouldn't my use of the "S####" as the mask work? It's just a string like your strInput?
I'M A DUMMY! I wasn't thinking of "Like" as being an Operator. I simply needed to rid the statement of the extraneous "<>".