Parameter Query

  • Thread starter Thread starter KathyJ
  • Start date Start date
K

KathyJ

I trying to pass 3 parameters to an append query.
The first 2 are dates that are added when the data is
appended to the new table. The 3rd parameter is the
criteria parameter. When I try and run the query from
code,I get the following error message,
"Parameter object is improperly defined. Inconsistant or
imcomplete information was provided."

Here is some of the code and the query:
'2nd parm
Set prmEndDate = cmd.CreateParameter("CEndDate",
adDate, , , varCEndDate)
cmd.Parameters.Append prmEndDate
'problem parm
Set prmCust = cmd.CreateParameter("PCust", , , ,
strCust)
cmd.Parameters.Append prmCust
and here's the query
PARAMETERS CBegDate DateTime, CEndDate DateTime, PCust
Value;
INSERT INTO UBILL_ARCHIVED_BILLING_E_TRANS (
COMPLEX_NUMBER, COMP_BEG_DATE, COMP_END_DATE )
SELECT UBILL_CURRENT_BILLING_E_TRANS.COMPLEX_NUMBER,
[CBegDate] AS Comp_Beg_Date, [CEndDate] AS Comp_End_Date
FROM UBILL_CURRENT_BILLING_E_TRANS
WHERE (((UBILL_CURRENT_BILLING_E_TRANS.COMPLEX_NUMBER)=
[PCust]));

I've also tried to change the PCust to a text , but that
didn't seem to help either.

This problem has something to do with the fact that the
first 2 parms are fields, while the 3rd parm is criteria.

Thanks.
 
Wouldn't you have to define your PCust parameter's data
type and length (if it's a string):

Set prmCust = cmd.CreateParameter("PCust",adVarChar,,100)
 
Back
Top