too few parameters 2

  • Thread starter Thread starter Rodolfo Fontes
  • Start date Start date
R

Rodolfo Fontes

Hi group,

While trying to export a query to a text file the following error occurs.
Too Few Parameters 2
What's that?

Thanks,
Rodolfo Fontes
 
The querie is

SELECT Format("54","00") AS 01_Tipo, IIf([CNPJ] Is Not
Null,Format([CNPJ],"00000000000000"),Format([CPF],"00000000000000")) AS
02_CNPJ, Format(1,"00") AS 03_Modelo,
Replace(Format(Left([Serie],3),"@@@")," ","0") AS 04_Serie,
Format([Numero_NF],"000000") AS 05_NumNF, Format([CFOP],"0000") AS 06_CFOP,
IIf([Cod_Sit_Trib] Is Null,[CodSitTrib],[Cod_Sit_Trib]) AS 07_CST,
Format([Apoio_sintegra],"000") AS 08_NumItem, Format(Left([T
NF_E_Det].[Part#F],14),"General Number") AS [09_Part#F],
Format([Qtd_NF],"00000000000") AS 10_Qtd, Format([Valor_NF],"0000000000") &
"00" AS 11_Valor_NF, "000000000000" AS 12_V_DESC,
Format([Valor_NF],"0000000000") & "00" AS 13_BASE_ICMS, "000000000000" AS
14_BASE_ICMS_CST,
Format(Round(Round([Valor_NF]*[Qtd_NF],2)*([IPI_NF]/100),2),"0000000000") &
"00" AS 15_VL_TOT_IPI, Format([ICMS_NF],"00") & "00" AS 16_AL_ICMS, [T
NF_E].DT_Emissao
FROM [T NatOper] INNER JOIN ([T CliFor] INNER JOIN ([T NF_E] INNER JOIN ([T
NF_E_Det] INNER JOIN [T Produtos_Itens] ON [T NF_E_Det].CodProd = [T
Produtos_Itens].CodProd) ON [T NF_E].Cod_NF_E = [T NF_E_Det].Cod_NF_E) ON [T
CliFor].CodCliFor = [T NF_E].CodCliFor_Fat) ON [T NatOper].CodNatOper = [T
NF_E].CodNatOper
WHERE ((([T NF_E].DT_Emissao) Between [Formulários]![F Sintegra]![txtDataI]
And [Formulários]![F Sintegra]![txtDataF]))
ORDER BY Format([Numero_NF],"000000"), Format([Apoio_sintegra],"000");

It's not a good solution...
But copying it to a table, then exporting works fine.
Is there anything wrong with this querie?

Thanks,
Rodolfo Fontes
 
It means that the command line you're using to run the query is missing data
or that the query is a parameter query and needs more input. How are you
exporting the query and what is the SQL of the query?
 
Rodolfo,

I think the error relates to the form references in the query criteria,
for example [Formulários]![F Sintegra]![txtDataI]. How are you trying
to use this query? What is the code, and where is it being called from?

--
Steve Schapel, Microsoft Access MVP

Rodolfo said:
The querie is

SELECT Format("54","00") AS 01_Tipo, IIf([CNPJ] Is Not
Null,Format([CNPJ],"00000000000000"),Format([CPF],"00000000000000")) AS
02_CNPJ, Format(1,"00") AS 03_Modelo,
Replace(Format(Left([Serie],3),"@@@")," ","0") AS 04_Serie,
Format([Numero_NF],"000000") AS 05_NumNF, Format([CFOP],"0000") AS 06_CFOP,
IIf([Cod_Sit_Trib] Is Null,[CodSitTrib],[Cod_Sit_Trib]) AS 07_CST,
Format([Apoio_sintegra],"000") AS 08_NumItem, Format(Left([T
NF_E_Det].[Part#F],14),"General Number") AS [09_Part#F],
Format([Qtd_NF],"00000000000") AS 10_Qtd, Format([Valor_NF],"0000000000") &
"00" AS 11_Valor_NF, "000000000000" AS 12_V_DESC,
Format([Valor_NF],"0000000000") & "00" AS 13_BASE_ICMS, "000000000000" AS
14_BASE_ICMS_CST,
Format(Round(Round([Valor_NF]*[Qtd_NF],2)*([IPI_NF]/100),2),"0000000000") &
"00" AS 15_VL_TOT_IPI, Format([ICMS_NF],"00") & "00" AS 16_AL_ICMS, [T
NF_E].DT_Emissao
FROM [T NatOper] INNER JOIN ([T CliFor] INNER JOIN ([T NF_E] INNER JOIN ([T
NF_E_Det] INNER JOIN [T Produtos_Itens] ON [T NF_E_Det].CodProd = [T
Produtos_Itens].CodProd) ON [T NF_E].Cod_NF_E = [T NF_E_Det].Cod_NF_E) ON [T
CliFor].CodCliFor = [T NF_E].CodCliFor_Fat) ON [T NatOper].CodNatOper = [T
NF_E].CodNatOper
WHERE ((([T NF_E].DT_Emissao) Between [Formulários]![F Sintegra]![txtDataI]
And [Formulários]![F Sintegra]![txtDataF]))
ORDER BY Format([Numero_NF],"000000"), Format([Apoio_sintegra],"000");

It's not a good solution...
But copying it to a table, then exporting works fine.
Is there anything wrong with this querie?

Thanks,
Rodolfo Fontes
 
As a follow up on Steve's comment. Is the form open with values in the
textboxes that you are referring to from the query?
 
Rodolfo Fontes said:
Hi group,

While trying to export a query to a text file the following error occurs.
Too Few Parameters 2
What's that?

Thanks,
Rodolfo Fontes
 

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

Back
Top