Re: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another

Tech-Archive recommends: Fix windows errors by optimizing your registry



Running this on Interbase 5.6

RBS

"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message news:exFWQ7NGIHA.3716@xxxxxxxxxxxxxxxxxxxxxxx
RB Smissaert wrote:
Trying to run a parameterized query with this SQL

UPDATE PATIENT P
SET P.REGISTRATION_START_DATE =
(SELECT MAX(P2.REGISTRATION_START_DATE)
FROM PATIENT P2
WHERE P2.PATIENT_ID IN(?, ?))
WHERE P.PATIENT_ID = ?

And running in VBA like this:

cmdADO.Execute , Array(lNewPID, lOldPID, lNewPID), adExecuteNoRecords

This gives the above error.

When I do this:

UPDATE PATIENT P
SET P.REGISTRATION_START_DATE =
(SELECT MAX(P2.REGISTRATION_START_DATE)
FROM PATIENT P2
WHERE P2.PATIENT_ID IN(?, ?))
WHERE P.PATIENT_ID = " & lNewPID

cmdADO.Execute , Array(lNewPID, lOldPID), adExecuteNoRecords

It all runs fine.

Why is there a problem with the first method?

I'm trying to reproduce this but Access refuses to run this query (operation must use updatable cursor), so I have to ask what database you are using.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages