Too Few Parameters. Expected 1?

  • Thread starter Thread starter PC
  • Start date Start date
P

PC

Hi,

I'm exporting a Union query from Access XP (2000 Format) to a Fixed Width
text file. The query itself works fine but when I attempt to Export the
Wizard starts and an error "Too few Parameters. 1 Expected" appears. The
parameter for the query is a String value and is referenced from a control
on a form which I beleive is the problem. i.e. "Jet doesn't reference the
control on the form".

An abbreviated verion of the query is as follows:

SELECT ChqID, SupAccountCode,
Right([DatePaid],4)+Mid([DatePaid],4,2)+Left([DatePaid],2) AS
TransactionDate, "Debit" as DCMarker
From tblInvoices
Where SupAccountCode = [Forms]![ParamForm]![ParamControl]
Union All SELECT ChqID, SupAccountCode,
Right([DatePaid],4)+Mid([DatePaid],4,2)+Left([DatePaid],2) AS
TransactionDate, "Credit" as DCmarker
from tblInvoices
Where SupAccountCode = [Forms]![ParamForm]![ParamControl]

from what I have read I should concatenate the values returned by the
referenced control but I can't seem to get this to work.

Any help on this would be appreciated.

...pc
 
The form has to be open for you to use this SELECT query.

Put a command button on the form and have the code under the command
button perform the Export using the TransferText action.

--
HTH

Dale Fye


Hi,

I'm exporting a Union query from Access XP (2000 Format) to a Fixed
Width
text file. The query itself works fine but when I attempt to Export
the
Wizard starts and an error "Too few Parameters. 1 Expected" appears.
The
parameter for the query is a String value and is referenced from a
control
on a form which I beleive is the problem. i.e. "Jet doesn't reference
the
control on the form".

An abbreviated verion of the query is as follows:

SELECT ChqID, SupAccountCode,
Right([DatePaid],4)+Mid([DatePaid],4,2)+Left([DatePaid],2) AS
TransactionDate, "Debit" as DCMarker
From tblInvoices
Where SupAccountCode = [Forms]![ParamForm]![ParamControl]
Union All SELECT ChqID, SupAccountCode,
Right([DatePaid],4)+Mid([DatePaid],4,2)+Left([DatePaid],2) AS
TransactionDate, "Credit" as DCmarker
from tblInvoices
Where SupAccountCode = [Forms]![ParamForm]![ParamControl]

from what I have read I should concatenate the values returned by the
referenced control but I can't seem to get this to work.

Any help on this would be appreciated.

...pc
 
Hi Dave,

This error occurs when the form is open. I think this problem is something
to do with the way Jet handles "Where" statements that refer to form
controls. Any ideas?

Thanks

Paul
 
What is the data type of the SupAccountCode field?

I've never had much problem with the way Jet handles WHERE statements
that refer to form controls, except when I have done something wrong

How are you using to implement this query and the export? Do you open
the form, then go to the databse window, run the query, and then try
to do the export? Have you tried my suggestion of using the
TransferText action from a command button on your form?

BTW, the SQL you posted below does not make a lot of sense. You are
selecting identical columns, from the same table, with the same where
clause, and giving one set a label of Debit, and the second set a
label of Credit. I realize you indicate this is an abbreviated query,
but it still makes no sense at all.
--
HTH

Dale Fye


Hi Dave,

This error occurs when the form is open. I think this problem is
something
to do with the way Jet handles "Where" statements that refer to form
controls. Any ideas?

Thanks

Paul
 
Dave,

To explain the SQL there are a few more fields, one of these is [Amount] and
the below that is (Amount]*-1). The Fixed width txt is then used to import
this data into our Accounts Application. For accounting purposed we have to
have a debit and a credit value for each transaction which bablances out.

Regarding the query, it runs fine (i.e. it picks up the form control entry
and displays the results) when I run it from the access query window.
Currently I'm just using the File > Export > Text File function and this is
where the problem starts. The problem occurs whether I have the query open
with the results displayed when I attempt to export or if I just select the
query in the query window.

I appreciate you help on this.

Paul



Dale Fye said:
What is the data type of the SupAccountCode field?

I've never had much problem with the way Jet handles WHERE statements
that refer to form controls, except when I have done something wrong

How are you using to implement this query and the export? Do you open
the form, then go to the databse window, run the query, and then try
to do the export? Have you tried my suggestion of using the
TransferText action from a command button on your form?

BTW, the SQL you posted below does not make a lot of sense. You are
selecting identical columns, from the same table, with the same where
clause, and giving one set a label of Debit, and the second set a
label of Credit. I realize you indicate this is an abbreviated query,
but it still makes no sense at all.
--
HTH

Dale Fye


Hi Dave,

This error occurs when the form is open. I think this problem is
something
to do with the way Jet handles "Where" statements that refer to form
controls. Any ideas?

Thanks

Paul

Dale Fye said:
The form has to be open for you to use this SELECT query.

Put a command button on the form and have the code under the command
button perform the Export using the TransferText action.

--
HTH

Dale Fye


Hi,

I'm exporting a Union query from Access XP (2000 Format) to a Fixed
Width
text file. The query itself works fine but when I attempt to Export
the
Wizard starts and an error "Too few Parameters. 1 Expected" appears.
The
parameter for the query is a String value and is referenced from a
control
on a form which I beleive is the problem. i.e. "Jet doesn't reference
the
control on the form".

An abbreviated verion of the query is as follows:

SELECT ChqID, SupAccountCode,
Right([DatePaid],4)+Mid([DatePaid],4,2)+Left([DatePaid],2) AS
TransactionDate, "Debit" as DCMarker
From tblInvoices
Where SupAccountCode = [Forms]![ParamForm]![ParamControl]
Union All SELECT ChqID, SupAccountCode,
Right([DatePaid],4)+Mid([DatePaid],4,2)+Left([DatePaid],2) AS
TransactionDate, "Credit" as DCmarker
from tblInvoices
Where SupAccountCode = [Forms]![ParamForm]![ParamControl]

from what I have read I should concatenate the values returned by the
referenced control but I can't seem to get this to work.

Any help on this would be appreciated.

..pc
 
Back
Top