We help IT Professionals succeed at work.
Get Started

Using RegExp in Access - data type mismatch error

PopoDi
PopoDi asked
on
300 Views
Last Modified: 2021-04-21
I asked a question about matching a pattern in MS Access 2002 a few weeks ago here and the answer worked great, but now that I have copied it to a different Access database (but basically the same table structure) I am getting the type mismatch errors and I cannot see why.

here is the RegExpFind function that I am using: http://vbaexpress.com/kb/getarticle.php?kb_id=841#instr

here is the sql statement that works:
SELECT P04055_PIW_DOC_REG.DOC_NAME
FROM P04055_PIW_DOC_REG
WHERE (((P04055_PIW_DOC_REG.REGAPP)='DSHEET') AND ((RegExpFind([P04055_PIW_DOC_REG.DOC_NAME],"^[A-Z]{1,3}-[A-Z]-\d{1,3}[A-Z]{1,5}\d{1,4}[A-Z]{0,1}-\d{1,2}$",False))=""));

here is the sql statement that produces "data type mismatch in criteria expression" (I also get the error when only using RegExpFind in WHERE)
SELECT P04055_PIW_DOC_REG.DOC_NAME
FROM P04055_PIW_DOC_REG
WHERE (((P04055_PIW_DOC_REG.REGAPP)='AT_PID') AND ((RegExpFind([P04055_PIW_DOC_REG.DOC_NAME],"^[A-Z]{1,3}-[A-Z]-\d{1,3}[A-Z]{1,5}\d{1,4}[A-Z]{0,1}-\d{1,2}$",False))=""));

Can somebody see what I am missing? TIA!
Dijana
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 15 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE