I have an if statement in a module that is looking at four fields to see if the criteria below is met. I am having trouble in checking fields Code1 and Code2 to see if they end with a specific text (field is 6-7 characters); one should end in AM and the other in BM.
My first approach was to check if they contain AM or BM which is why you see InStr, but that isn't working. As I wrote this post, I think its best to check they end in those characters but don't know how to adjust from here.
Field Value
Cat CL <--- exact match
ValRule M - M <--- exact match
Code1 AM <----ends in AM
Code2 BM <----ends in BM
Code:
If Cat = "CL" And ValRule = "M - M" And InStr(1, Code1, "AM") > 0 And InStr(1, Code2, "BM") > 0 Then
Test = "Pass"