replace function show stopper

  • Thread starter Thread starter Kal
  • Start date Start date
K

Kal

Hi everyone,

I am having a very strange problem with the replace() function. I am
trying to run the following select statement from within a vba module
and am getting a 'data type mismatch error in criteria expression'

SELECT ThreeGProcessChangeRequest.[Issue ID],
ThreeGProcessChangeRequest.[Title] " & _
"FROM ThreeGProcessChangeRequest WHERE ThreeGProcessChangeRequest.
[Status]<>'Closed' And ThreeGProcessChangeRequest.[Status]<>'Pending
Implementation' AND Replace(ThreeGProcessChangeRequest.[Assigned
To],',','') ='" & UserName & "' ORDER BY [Issue ID];"


UserName is irrelevant because even when I hardcode a name in this
area I get the error. But if I remove the replace function the error
goes away...I can do no comparison right now if I can't get this to
work.

Thank you,

SR
 
Replace needs double-quotes, not single quotes.

Try using

Replace(ThreeGProcessChangeRequest.[Assigned To],"","","""")

(that's two double quotes on either side of the comma as the 2nd parameter,
then four double quotes as the 3rd parameter)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Replace function 4
return without gosub error 0
Replace Function and Data Type Mismatch in Results 7
#Error 9
Update a table with a crosstab query 1
Replace function in Access 1
Typing vs VBA 9
Query Help 3

Back
Top