Search code examples
stringvbacontains

How do I find if a string contains "vbNewLine" or "enter keypress"?


I am currently editing a code in VB Codes in MS Access. How do I find if a String contains "vbNewLine" or "enter keypress" ?

I tried

tf = AnforderungVal.contains(vbNewLine)

But I always get a "Invalid Identifier" error.

What could I be doing wrong?


Solution

  • VBA doesn't have a Contains method. Instead use Instr and something like:

    tf= Instr(AnforderungVal,vbnewline) > 0