Data type mismatch when querying Tax ID

Darrell Burns 141 Reputation points

I've created a simple query to look up customers by Tax ID. Since the users don't always insert the hyphens in the right place, I strip out the hyphens using the REPLACE function. But the query throws a Data Type Mismatch error (see example). I've tried converting the stripped TIN with CSTR and CDBL, but to no avail.
Anybody have any ideas?60711-access-bug.png

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
830 questions
0 comments No comments
{count} votes

2 additional answers

Sort by: Most helpful
  1. Bruce H 1 Reputation point

    What is the datatype of TIN in your table? If it is a long integer, try Clng(Replace(...))

    0 comments No comments

  2. Darrell Burns 141 Reputation points

    It's a string. It couldn't be numeric with hyphens in it.